develooper Front page | perl.perl5.porters | Postings from September 2013

[perl #118059] race condition+fail in dist\IO\t\cachepropagate-tcp.t

Thread Previous | Thread Next
bulk88 via RT
September 20, 2013 08:15
[perl #118059] race condition+fail in dist\IO\t\cachepropagate-tcp.t
Message ID:
On Wed Aug 28 18:09:32 2013, tonyc wrote:
> The output from a failed run looked like:
> 1..8
> ok 1 - socket created
> ok 2 - protocol defined
> ok 3 - domain defined
> ok 4 - type defined
> ok 5 - spawned a child
> accept(3 (112)) => 236 but osfhandle returned bad -1
> Can't use an undefined value as a symbol reference at
> ../dist/IO/t/cachepropagate-tcp.t line 49.
> # Looks like you planned 8 tests but ran 5.
> # Looks like your test exited with 9 just after 5.
> So it seems some race is closing the accept()ed socket before we get to
> use it.
> Pretty much any output I do in the child or parent before the accept()
> prevents the problem from occuring for me, which makes it difficult to
> Tony

Using freeze/thaw features of the parent and child OS threads, the bug
can be prevented.  2 theories I have

1. somewhere a CloseHandle was done on a socket handle, which isn't
allowed on paper, because supposedly there are winsock user-mode
resources which aren't cleaned up when the kernel handle (a socket on NT
is a kernel handle from the AFD driver, IDK if its true that the AFD
driver won't cleanup/do a callback to the usermode winsock side when the
kernel handle is closed) is closed.

2. a double free (using the correct closesocket() command) was done,
when the child psuedo proc exited

I include 2 screen shots of why I think the above. The break happened at
a invalid handle exception from zwclose/ntclose. Notice it came from the
usermode winsock dll.

bulk88 ~ bulk88 at

via perlbug:  queue: perl5 status: open

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About