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

Zhihua Deng commented on THRIFT-5875:
-------------------------------------

[~fishywang] for TProtocolExceptions yes, the client can get the exception. 
While for 
TTransportException, in Java lib we ignore the TTransportException in 
ProcessFunction while reading the args from stream: 
[https://github.com/apache/thrift/blob/master/lib/java/src/main/java/org/apache/thrift/ProcessFunction.java#L22-L34]
so the client would miss that exception, though it might be related to 
application logic, i.e, large message sent.
As far as I know, for INVALID_DATA, mainly used in java/cpp TJSONProtocol, to 
indicate the invalid message, CORRUPTED_DATA for telling whether the transport 
has sent a good stream the thrift can understand/read. MESSAGE_SIZE_LIMIT is 
for counting the total message received for this current call, while SIZE_LIMIT 
for restricting the size of the string or container read from the stream. So 
they are a bit different, TProtocolExceptions for the wrong/invalid message, 
while TTransportExceptions for the unexpected stream.

> ServerContext offers API to catch the thrift exception
> ------------------------------------------------------
>
>                 Key: THRIFT-5875
>                 URL: https://issues.apache.org/jira/browse/THRIFT-5875
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Java - Library
>            Reporter: Zhihua Deng
>            Assignee: Zhihua Deng
>            Priority: Major
>
> If we the exception thrown from transport lawyer, such as the
> MESSAGE_SIZE_LIMIT or CORRUPTED_DATA, in order not to pollute the byte 
> stream, the server will kill the transport, on the client side it would 
> receive the message indicating the socket is killed by peer. It's would be 
> nice if we can send the exception back to the client to tell what's happening 
> on the server side, the TServerEventHandler deleteContext provides a way for 
> such purpose if we can get the exception from the ServerContext. 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to