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] [Closed] (THRIFT-5175) Maybe a race condition in TThreadedServerPool java implementation
Date Thu, 16 Apr 2020 11:01:00 GMT

     [ https://issues.apache.org/jira/browse/THRIFT-5175?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Xiangdong Huang closed THRIFT-5175.
-----------------------------------
    Resolution: Not A Problem

Hi,

I have checked the codes, it is because close() is called before calling TThreadPoolServer.serve().

> 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
>            Priority: Major
>         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
> WARN  [2020-04-16 02:14:46,097] [RPC-ServerServiceImpl] org.apache.thrift.server.TThreadPoolServer:230
- Transport error occurred during acceptance of message. 
> org.apache.thrift.transport.TTransportException: No underlying server socket. 
> at org.apache.thrift.transport.TServerSocket.acceptImpl(TServerSocket.java:126) 
> at org.apache.thrift.transport.TServerSocket.acceptImpl(TServerSocket.java:35) 
> at org.apache.thrift.transport.TServerTransport.accept(TServerTransport.java:60) 
> at org.apache.thrift.server.TThreadPoolServer.execute(TThreadPoolServer.java:185) 
> at org.apache.thrift.server.TThreadPoolServer.serve(TThreadPoolServer.java:175) 
> at org.apache.iotdb.db.service.RPCService$RPCServiceThread.run(RPCService.java:219)
> WARN  [2020-04-16 02:14:46,103] [RPC-ServerServiceImpl] org.apache.thrift.server.TThreadPoolServer:230
- Transport error occurred during acceptance of message. 
> org.apache.thrift.transport.TTransportException: No underlying server socket. 
> at org.apache.thrift.transport.TServerSocket.acceptImpl(TServerSocket.java:126) 
> at org.apache.thrift.transport.TServerSocket.acceptImpl(TServerSocket.java:35) 
> at org.apache.thrift.transport.TServerTransport.accept(TServerTransport.java:60) 
> at org.apache.thrift.server.TThreadPoolServer.execute(TThreadPoolServer.java:185) 
> at org.apache.thrift.server.TThreadPoolServer.serve(TThreadPoolServer.java:175) 
> at org.apache.iotdb.db.service.RPCService$RPCServiceThread.run(RPCService.java:219)
> WARN  [2020-04-16 02:14:46,105] [RPC-ServerServiceImpl] org.apache.thrift.server.TThreadPoolServer:230
- Transport error occurred during acceptance of message. 
> org.apache.thrift.transport.TTransportException: No underlying server socket. 
> at org.apache.thrift.transport.TServerSocket.acceptImpl(TServerSocket.java:126) 
> at org.apache.thrift.transport.TServerSocket.acceptImpl(TServerSocket.java:35) 
> at org.apache.thrift.transport.TServerTransport.accept(TServerTransport.java:60) 
> at org.apache.thrift.server.TThreadPoolServer.execute(TThreadPoolServer.java:185) 
> at org.apache.thrift.server.TThreadPoolServer.serve(TThreadPoolServer.java:175) 
> 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