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

Yuxuan Wang commented on THRIFT-5875:
-------------------------------------

`MESSAGE_SIZE_LIMIT` should be the `SIZE_LIMIT` in other languages which is an 
enum of `TProtocolExceptionType` used in TProtocolException (examples: 
[cpp|https://github.com/apache/thrift/blob/f0f72d8e7e99341b37916ed3c7762602394d54a4/lib/cpp/src/thrift/protocol/TProtocolException.h#L46],
 
[go|https://github.com/apache/thrift/blob/f0f72d8e7e99341b37916ed3c7762602394d54a4/lib/go/thrift/protocol_exception.go#L37]),
 and `CORRUPTED_DATA` should be `INVALID_DATA` which is also an 
`TProtocolExceptionType` 
([cpp|https://github.com/apache/thrift/blob/f0f72d8e7e99341b37916ed3c7762602394d54a4/lib/cpp/src/thrift/protocol/TProtocolException.h#L44],
 
[go|https://github.com/apache/thrift/blob/f0f72d8e7e99341b37916ed3c7762602394d54a4/lib/go/thrift/protocol_exception.go#L35])?

For TProtocolExceptions, the server _should_ send the exception back before 
closing the connection.

> 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