[ 
https://issues.apache.org/jira/browse/THRIFT-1805?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15047344#comment-15047344
 ] 

Christopher Tubbs commented on THRIFT-1805:
-------------------------------------------

I'm not sure it's a matter of just improving through patches/testing/QA fixes. 
I think it's also a matter of PMC direction to determine some guidelines on 
behavior for the code, so it doesn't regress every time somebody has a new use 
case. Patches can be evaluated against those guidelines.

In this case, for example, there was a regression introduced, which had 
occurred and been fixed before (THRIFT-1658). Examining the code, there appears 
to have been a conscious decision at one point to create two classes of 
exceptions, yet the regression overruled this prior decision. That shouldn't 
have happened if that decision had been encapsulated into some guidelines for 
expected behavior.

In other cases, regressions have flip-flopped (THRIFT-2173 and related) several 
times, each time the patch being accepted without much question, even though it 
reversed a prior decision.

In addition to patches/testing/QA, I think the Thrift PMC could help this 
situation by making some decisions for the project going forward, to increase 
stability. Some such things:

1. Adopt Semantic Versioning with a well-defined public API which addresses 
libraries, the IDL, and generated code.
2. Adopt a policy for maintaining on-the-wire compatibility in terms of the 
versioning scheme chosen.
3. When a change in behavior causes problems and a decision must be made, 
document the behavior which was decided upon (even if it's just a comment in 
the code), so that future patches do not reverse prior decisions, without some 
degree of oversight.

These aren't foolproof, but some guidelines for the direction of the project 
could help contributors make higher quality contributions.

> Thrift should not swallow ALL exceptions
> ----------------------------------------
>
>                 Key: THRIFT-1805
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1805
>             Project: Thrift
>          Issue Type: Bug
>          Components: Java - Compiler, Java - Library
>    Affects Versions: 0.9
>            Reporter: Diwaker Gupta
>            Assignee: Diwaker Gupta
>         Attachments: THRIFT-1805.patch
>
>
> In Thrift 0.8.0, Thrift generated Java code did not swallow application 
> exceptions. As a result of THRIFT-1658, this behavior changed in 0.9.0 and 
> now the generated code swallows ALL application exceptions (via 
> ProcessFunction). Apparently this was the behavior in Thrift 0.6.0 and while 
> I see the rationale, it is breaking our applications.
> Our code relies on the fact that exceptions can propagate outside of Thrift 
> for certain things (e.g., to aggressively drop connections for clients that 
> send invalid/malformed requests). ProcessFunction makes it near impossible to 
> do this -- not only does it swallow the exception, it also loses all 
> information about the original exception and just writes out a generic 
> TApplicationException.
> IMO ProcessFunction should only catch TException. If the application code 
> wants to use other exceptions for some reason (in particular, Errors and 
> RuntimeExceptions), Thrift shouldn't prevent that.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to