Amichai Rothman created ARIES-2119:
--------------------------------------
Summary: TCPServer concurrency issue when accepting sockets
Key: ARIES-2119
URL: https://issues.apache.org/jira/browse/ARIES-2119
Project: Aries
Issue Type: Bug
Components: Remote Service Admin
Affects Versions: rsa-1.16.1
Reporter: Amichai Rothman
Currently the TCPServer spawns multiple threads, and all of them call
ServerSocket.accept() concurrently, however this class is not thread-safe.
JDK-8278270 implies this is fixed in OpenJDK 18, however the ServerSocket API
documentation has no mention of this so it's likely a specific implementation
detail and not a guarantee.
In any case, it's a non-conventional idiom - the common pattern is to have a
single thread calling accept in a loop, then handing the accepted sockets over
to other threads for handling the connections.
In addition, the running flag accessed by all of the threads is not thread-safe
either. It should at least be volatile.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)