You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Discovered in the module dcm4che-tool-storescu, when running storescu and dcmqrscp on AWS ec2 t2.medium instance.
Both are configured to use TLS, the problem doesn't seem to appear when using plain sockets.
Run of the storescu command sometimes results in the following intermitten exception:
java.net.SocketException: Socket is closed
at sun.security.ssl.SSLSocketImpl.checkEOF(SSLSocketImpl.java:1520)
at sun.security.ssl.SSLSocketImpl.checkWrite(SSLSocketImpl.java:1541)
at sun.security.ssl.AppOutputStream.write(AppOutputStream.java:124)
at java.io.OutputStream.write(OutputStream.java:75)
at org.dcm4che3.net.PDUEncoder.write(PDUEncoder.java:126)
at org.dcm4che3.net.PDUEncoder.writeAReleaseRQ(PDUEncoder.java:101)
at org.dcm4che3.net.Association.writeAReleaseRQ(Association.java:395)
at org.dcm4che3.net.State$4.writeAReleaseRQ(State.java:108)
at org.dcm4che3.net.Association.release(Association.java:312)
at org.dcm4che3.tool.storescu.StoreSCU.close(StoreSCU.java:511)
at org.dcm4che3.tool.storescu.StoreSCU.main(StoreSCU.java:300)
The process quits with non-zero exit code.
There are no errors on the dcmqrscp side.
The cause of the failure is a race condition between two threads on the association release:
main:
StoreSCU opens a connection, sends data and executes as.release;
as.release calls writeAReleaseRQ() that writes A-RELEASE-RQ to the SSLSocket;
it doesn't finish writing when the second thread closes the socket.
pool-1-thread-1:
dcmqrscp server responds with A-RELEASE-RP;
this thread reads it from the SSLSocket;
it goes on and closes the socket, interrupting the first thread's write operation.
Environment:
AWS ec2 t2.medium instance
OS: CentOS Linux release 7.2.1511 (Core)
JAVA: Java HotSpot(TM) 64-Bit Server VM (build 1.8.0_40-b26)
Discovered in the module dcm4che-tool-storescu, when running storescu and dcmqrscp on AWS ec2 t2.medium instance.
Both are configured to use TLS, the problem doesn't seem to appear when using plain sockets.
Run of the storescu command sometimes results in the following intermitten exception:
The process quits with non-zero exit code.
There are no errors on the dcmqrscp side.
The cause of the failure is a race condition between two threads on the association release:
StoreSCU opens a connection, sends data and executes as.release;
as.release calls writeAReleaseRQ() that writes A-RELEASE-RQ to the SSLSocket;
it doesn't finish writing when the second thread closes the socket.
dcmqrscp server responds with A-RELEASE-RP;
this thread reads it from the SSLSocket;
it goes on and closes the socket, interrupting the first thread's write operation.
Environment:
Steps to reproduce:
Attached files aws-socket-closed.tar.gz:
Possible solution:
adding a synchronized block in Association.writeAReleaseRQ() fixes the issue:
This bug may probably affect other parts of the code, as the synchronization issue lies in Association class.
The text was updated successfully, but these errors were encountered: