RFR 8006395: Race in async socket close on Linux

Chris Hegarty chris.hegarty at oracle.com
Thu Jan 31 08:29:51 PST 2013


On 01/31/2013 02:34 PM, Alan Bateman wrote:
> On 30/01/2013 21:36, Chris Hegarty wrote:
>> There is a very small, and very old, window for a race in the socket
>> asynchronous close mechanism on Linux. This can lead to blocking
>> socket operations never returning even after the socket has been closed.
>>
>> This issue would appear to exist since its (linux_close.c) creation
>> back in 1.4, but since the window for the race is tiny, it seems to
>> have gone unnoticed until now.
> I think at the time that close would block if there was another thread
> doing I/O so this may be why the signal was queued first.

And this still appears to be the case on Mac. I have not changed the mac 
version of this function (I was not able to produce the problem after 
1000's of test runs), but it may be that we need to revisit this at a 
future stage. Maybe a sequence of interrupt, close/dup2, interrupt. But 
for now, lets go with the current changes.

> The proposed change looks good to me.

 > Chris,
 > Looks good for me.
 > -Dmitry

Alan and Dmitry, thanks for the reviews.

-Chris.

>
> -Alan



More information about the net-dev mailing list