This is the mail archive of the
mailing list for the GCC project.
[Bug libgcj/29604] Race condition in ServerSocket.accept()
- From: "daney at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 26 Oct 2006 17:56:11 -0000
- Subject: [Bug libgcj/29604] Race condition in ServerSocket.accept()
- References: <email@example.com/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from daney at gcc dot gnu dot org 2006-10-26 17:56 -------
This is trickier than I initially thought.
You cannot remained blocked in accept() while holding a lock that protects
closing the native_fd. Otherwise you will be blocked until a connection
arrives (perhaps forever). If we can shutdown the socket without holding the
lock, but not close it, there may be a path that will not deadlock. Not
closing the native_fd is key as doing that allows the OS to open a new resource
with the same fd. Which is the problem to be solved.