This is the mail archive of the
java-prs@gcc.gnu.org
mailing list for the Java 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: java-prs at gcc dot gnu dot org
- Date: 26 Oct 2006 17:56:11 -0000
- Subject: [Bug libgcj/29604] Race condition in ServerSocket.accept()
- References: <bug-29604-7151@http.gcc.gnu.org/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.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29604