thrift-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mario Emmenlauer (JIRA)" <>
Subject [jira] [Commented] (THRIFT-4598) TBinaryProtocol.readMessageBegin() hangs forever in Java
Date Thu, 05 Jul 2018 10:52:00 GMT


Mario Emmenlauer commented on THRIFT-4598:

You are right, I was somehow jumping to a wrong conclusion. I was using before:
TServer server = new TThreadPoolServer(...)
and changed it to:
TThreadPoolServer server = new TThreadPoolServer(...)
But that was not the relevant change, I was just confusing myself.

I changed also the timeouts again. This must have helped:
const int vTimeoutSec = 30;
TServerTransport vServerTransport = new TServerSocket(vServerPort, 1000*vTimeoutSec);
TThreadPoolServer.Args vTThreadPoolServerArgs = new TThreadPoolServer.Args(vServerTransport);
I think I tested this before, but in any case, since I enforce all timeouts again it seems
to be working and the connection closes automatically after a while.
 Thanks a lot for your help!

> TBinaryProtocol.readMessageBegin() hangs forever in Java
> --------------------------------------------------------
>                 Key: THRIFT-4598
>                 URL:
>             Project: Thrift
>          Issue Type: Bug
>          Components: Java - Library
>    Affects Versions: 0.11.0
>         Environment: Ubuntu Linux 16.04 x86_64
>            Reporter: Mario Emmenlauer
>            Assignee: James E. King III
>            Priority: Major
> I run some internal tests for the robustness of our thrift Java server. One of the robustness
tests is to try to connect to the secure server socket with an insecure client and vice versa.
This may seem a slightly diabolic test but it can be a simple user error to forget enabling
or disabling encryption. So I think thrift should handle this gracefully.
> However it seems that this test leads to an infinitely hanging server thread! The thread
blocks the jvm (Java 1.8.0_161 x86_64) from ending. I can see in jstack that the main method
ends and there are almost no threads left, except some garbage collectors and finalizers
plus org.apache.thrift.server.TThreadPoolServer.
> Here is the call stack of the thrift server thread:
> {code:java}
> java.lang.Thread.State: RUNNABLE
> at Method)
> at
> at
> at
> at
> at
> at
> - locked <0x000000067b390fd8> (a
> at
> at org.apache.thrift.transport.TTransport.readAll(
> at org.apache.thrift.protocol.TBinaryProtocol.readAll(
> at org.apache.thrift.protocol.TBinaryProtocol.readI32(
> at org.apache.thrift.protocol.TBinaryProtocol.readMessageBegin(
> at org.apache.thrift.TBaseProcessor.process(
> at org.apache.thrift.server.TThreadPoolServer$
> at java.util.concurrent.ThreadPoolExecutor.runWorker(
> at java.util.concurrent.ThreadPoolExecutor$
> at
> {code}
> I already reduced the server socket timeout to 30sec and the requestTimeout to 10sec.
Is there anything else I can do to timeout readMessageBegin()?

This message was sent by Atlassian JIRA

View raw message