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

ASF GitHub Bot commented on THRIFT-3769:
----------------------------------------

jeking3 closed pull request #1543: THRIFT-3769 : Fix logic of THRIFT-2268
URL: https://github.com/apache/thrift/pull/1543
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/lib/java/src/org/apache/thrift/server/TThreadPoolServer.java 
b/lib/java/src/org/apache/thrift/server/TThreadPoolServer.java
index 53c20e98fe..3b5f21e84c 100644
--- a/lib/java/src/org/apache/thrift/server/TThreadPoolServer.java
+++ b/lib/java/src/org/apache/thrift/server/TThreadPoolServer.java
@@ -311,14 +311,24 @@ public void run() {
               break;
             }
         }
-      } catch (TSaslTransportException ttx) {
-        // Something thats not SASL was in the stream, continue silently
-      } catch (TTransportException ttx) {
-        // Assume the client died and continue silently
       } catch (TException tx) {
         LOGGER.error("Thrift error occurred during processing of message.", 
tx);
       } catch (Exception x) {
-        LOGGER.error("Error occurred during processing of message.", x);
+        // We'll usually receive RuntimeException types here
+        // Need to unwrap to ascertain real causing exception before we choose 
to ignore
+        Throwable realCause = x.getCause();
+        // Ignore err-logging all transport-level/type exceptions
+        if ((realCause != null && realCause instanceof TTransportException)
+            || (x instanceof TTransportException)) {
+          if (LOGGER.isDebugEnabled()) {
+            // Write to debug, just in case the exception gets required
+            LOGGER
+                .debug("Received TTransportException during processing of 
message, ignoring: ", x);
+          }
+        } else {
+          // Log the exception at error level and continue
+          LOGGER.error("Error occurred during processing of message.", x);
+        }
       } finally {
         if (eventHandler != null) {
           eventHandler.deleteContext(connectionContext, inputProtocol, 
outputProtocol);


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Fix logic of THRIFT-2268
> ------------------------
>
>                 Key: THRIFT-3769
>                 URL: https://issues.apache.org/jira/browse/THRIFT-3769
>             Project: Thrift
>          Issue Type: Bug
>          Components: Java - Library
>    Affects Versions: 0.9.2
>            Reporter: Harsh J
>            Assignee: James E. King, III
>            Priority: Minor
>         Attachments: THRIFT-3769.patch
>
>
> THRIFT-2268 intended to reduce the logging noise of TSaslTransport enabled 
> servers, but the commit doesn't help in doing so (its just adding more 
> specific noise today).
> This is because the transport factory overrides disallow throwing specific 
> execution types (no TTransportException in signature), and thereby all 
> implementations will throw a RuntimeException-wrapped exception, which the 
> added catch clauses would never encounter.
> https://github.com/apache/thrift/blob/master/lib/java/src/org/apache/thrift/transport/TSaslServerTransport.java#L217-L219
> https://github.com/apache/thrift/blob/master/lib/java/src/org/apache/thrift/server/TThreadPoolServer.java#L290-L295
> We'll need to unwrap the RuntimeException to perform an actual valid cause 
> check.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to