RFC: Too many race conditions.

mark@mark.mielke.cc mark@mark.mielke.cc
Sun May 27 13:18:00 GMT 2007


On Sun, May 27, 2007 at 11:13:47AM +0200, Florian Weimer wrote:
> > No. Dave already described this a few times. If close() cannot execute
> > until accept() completes, then close() cannot be used to cause the
> > accept() to complete prematurely. Therefore, blocking accept() loop
> > lives forever, until the next accept() completes.
> > User space *cannot* solve this problem.
> Userspace can interrupt the relevant threads before calling close().
> This needs quite a bit of synchronization, though.

It becomes a bit irrelevant at some point - but "interrupt a blocking
system call" is not user space. It would require a system call of some
sort. The only way I can think of is either raising a signal with
kill(), which may be difficult to manage under threads portably, or by
executing shutdown(), which is specific to sockets, and does not solve
a potentially general problem with all blocking I/O.

Cheers,
mark

-- 
mark@mielke.cc / markm@ncf.ca / markm@nortel.com     __________________________
.  .  _  ._  . .   .__    .  . ._. .__ .   . . .__  | Neighbourhood Coder
|\/| |_| |_| |/    |_     |\/|  |  |_  |   |/  |_   | 
|  | | | | \ | \   |__ .  |  | .|. |__ |__ | \ |__  | Ottawa, Ontario, Canada

  One ring to rule them all, one ring to find them, one ring to bring them all
                       and in the darkness bind them...

                           http://mark.mielke.cc/



More information about the Java mailing list