thrift-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Xiangdong Huang (Jira)" <j...@apache.org>
Subject [jira] [Created] (THRIFT-5175) Maybe a race condition in TThreadedServerPool java implementation
Date Thu, 16 Apr 2020 02:40:00 GMT
Xiangdong Huang created THRIFT-5175:
---------------------------------------

             Summary: Maybe a race condition in TThreadedServerPool java implementation
                 Key: THRIFT-5175
                 URL: https://issues.apache.org/jira/browse/THRIFT-5175
             Project: Thrift
          Issue Type: Bug
          Components: Java - Library
    Affects Versions: 0.13.0
            Reporter: Xiangdong Huang
         Attachments: image-2020-04-16-10-36-00-871.png, log.log

Hi, 

I notice THRIFT-1795 https://issues.apache.org/jira/browse/THRIFT-1795 solves a problem of
the race condition in TThreadedServerPool.

 

However , now when I use Thrift v0.13.0, I occur the same problem..

 

Some codes:

The poolServer is TThreadPoolServer.

The serverTransport is TServerSocket.

I have a thread to run poolServer.serve().

And, another thread will call the following close() method to close the thrift.

 
{code:java}
// code placeholder
private synchronized void close() {
  if (poolServer != null) {
    poolServer.stop();
    poolServer = null;
  }
  if (serverTransport != null) {
    serverTransport.close();
    serverTransport = null;
  }
}
{code}
 

 

 

Then, after calling the above close() method, the console will print:

 
{code:java}
// code placeholder
ARN  [2020-04-16 02:14:46,077] [RPC-ServerServiceImpl] org.apache.thrift.server.TThreadPoolServer:230
- Transport error occurred during acceptance of message. 1593org.apache.thrift.transport.TTransportException:
No underlying server socket.1594	at org.apache.thrift.transport.TServerSocket.acceptImpl(TServerSocket.java:126)1595
at org.apache.thrift.transport.TServerSocket.acceptImpl(TServerSocket.java:35)1596	at org.apache.thrift.transport.TServerTransport.accept(TServerTransport.java:60)1597
at org.apache.thrift.server.TThreadPoolServer.execute(TThreadPoolServer.java:185)1598	at org.apache.thrift.server.TThreadPoolServer.serve(TThreadPoolServer.java:175)1599
at org.apache.iotdb.db.service.RPCService$RPCServiceThread.run(RPCService.java:219)1600WARN
 [2020-04-16 02:14:46,088] [RPC-ServerServiceImpl] org.apache.thrift.server.TThreadPoolServer:230
- Transport error occurred during acceptance of message. 1601org.apache.thrift.transport.TTransportException:
No underlying server socket.1602	at org.apache.thrift.transport.TServerSocket.acceptImpl(TServerSocket.java:126)1603
at org.apache.thrift.transport.TServerSocket.acceptImpl(TServerSocket.java:35)1604	at org.apache.thrift.transport.TServerTransport.accept(TServerTransport.java:60)1605
at org.apache.thrift.server.TThreadPoolServer.execute(TThreadPoolServer.java:185)1606	at org.apache.thrift.server.TThreadPoolServer.serve(TThreadPoolServer.java:175)1607
at org.apache.iotdb.db.service.RPCService$RPCServiceThread.run(RPCService.java:219)
{code}
This exception repeats infinitely.

 

 

The issues is hard to be reproduced on my MacOS, but can be reproduced on Travis-CI, in some
environments (Linux-openjdk11, linux-openjdk8, win-openjdk11):

!image-2020-04-16-10-36-00-871.png|width=1178,height=413!

I attached a log file here (but maybe it can not give you more info).

 

I read the source code and feel that it is very strange. Thrift has marked the stopped_ field
as volatile, I do not know why the execute() method of TThreadPoolServer does not break
out the loop.

 

 

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Mime
View raw message