Proposal: a revoke() system call

Sergey Babkin babkin at verizon.net
Mon Jul 7 17:33:06 UTC 2008


>>> issue that calling close(2) on a socket from one thread doesn't interrupt a 
>>> socket in a blocking I/O call from another thread -- you first have to call 
>>> shutdown(2), and then close(2).  This has caused problems for Java in the 
>>> past, but I'm not sure that it's really a bug given that it's not 
>>> unreasonable behavior not rejected by the spec :-).
>>
>> Maybe I'll see if I can fix that.
>
>Well, fixing this is easy -- instead of holding a reference to the file 
>descriptor over the system call, hold a reference to the socket.  The problem 
>with that is that it creates a lot more contention on the socket locks when 
>the reference count is dropped, not to mention more locking operations.  This 
>can be fixed but requires quite a lot of work, whereas this rather minor 
>semantic issue is a non-problem in practice.  I do have dealing with this 

I can't comment much without actually looking at the code, but why would the
contention on close() be such an issue? Close() is not called that often, compared for example to read(), so
there should not be much contention to start with. And why not just
call the shutdown() logic from inside close() implementation? 

-SB



More information about the freebsd-arch mailing list