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

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

Thread Previous
From:
bulk88
Date:
May 20, 2013 03:25
Subject:
[perl #118059] race condition+fail in dist\IO\t\cachepropagate-tcp.t
Message ID:
rt-3.6.HEAD-2650-1369020290-1146.118059-75-0@perl.org
# New Ticket Created by  bulk88 
# Please include the string:  [perl #118059]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=118059 >


This is a bug report for perl from bulk88@hotmail.com,
generated with the help of perlbug 1.39 running under perl 5.19.0.


-----------------------------------------------------------------
[Please describe your issue here]

There is a race condition in cachepropagate-tcp.t between the parent 
proc's accept() and the child proc's connection since the child proc has 
a "sleep(1);" delay. On my Win32 32 bit, Server 2003 x64, 8 core, VC 
2008 Perl, the ->accept() times out, does not return an obj, and then 
fatally errors when ->sockdomain() is called on an undefined scalar. Example

___________________________________________________________________________
C:\p519\src\t>..\perl.exe -I..\lib harness ../dist/IO/t/cachepropagate-tcp.t
../dist/IO/t/cachepropagate-tcp.t .. 1/8 Can't call method "sockdomain" 
on an un
defined value at t/cachepropagate-tcp.t line 46.
# Looks like you planned 8 tests but ran 5.
# Looks like your test exited with 9 just after 5.
../dist/IO/t/cachepropagate-tcp.t .. Dubious, test returned 9 (wstat 
2304, 0x900
)
Failed 3/8 subtests

Test Summary Report
-------------------
../dist/IO/t/cachepropagate-tcp.t (Wstat: 2304 Tests: 5 Failed: 0)
  Non-zero exit status: 9
  Parse errors: Bad plan.  You planned 8 tests but ran 5.
Files=1, Tests=5,  2 wallclock secs ( 0.03 usr +  0.00 sys =  0.03 CPU)
Result: FAIL

C:\p519\src\t>
___________________________________________________________________________

running with -v,
___________________________________________________________________________
C:\p519\src\t>..\perl.exe -I..\lib harness -v 
../dist/IO/t/cachepropagate-tcp.t
../dist/IO/t/cachepropagate-tcp.t ..
1..8
ok 1 - socket created
ok 2 - protocol defined
ok 3 - domain defined
ok 4 - type defined
ok 5 - spawned a child
Can't call method "sockdomain" on an undefined value at 
t/cachepropagate-tcp.t l
ine 46.
# Looks like you planned 8 tests but ran 5.
# Looks like your test exited with 9 just after 5.
Dubious, test returned 9 (wstat 2304, 0x900)
Failed 3/8 subtests

Test Summary Report
-------------------
../dist/IO/t/cachepropagate-tcp.t (Wstat: 2304 Tests: 5 Failed: 0)
  Non-zero exit status: 9
  Parse errors: Bad plan.  You planned 8 tests but ran 5.
Files=1, Tests=5,  1 wallclock secs ( 0.02 usr +  0.00 sys =  0.02 CPU)
Result: FAIL

C:\p519\src\t>
__________________________________________________________________________

line 46 is
__________________________________________________________________________
    my $new = $listener->accept();

 >>>>>>>>>>>>>>>>>>    is($new->sockdomain(), $d, 'domain match');
__________________________________________________________________________

accept the function in IO::Socket::accept the method fails with $! being 
"Bad file descriptor"/9. From my research on my machine the timeout is 
undefined, so IO::Select and can_read parts of IO::Socket::accept are 
not executed.

The failing test was added in 
http://perl5.git.perl.org/perl.git/commit/93a5d7bfc07a41ef26fb3e3b298a7d88c3741ed1?f=dist/IO/t/cachepropagate-tcp.t 
as part of CPAN RT #61577 and was written by Daniel Kahn Gillmor. I dont 
see any explanation for the "sleep(1);" in the child fork proc.

If I put a "sleep(1);" before the ->accept(), it passes for me most (4 
trys pass, 5th failed) of the time. If I put a 2 sec sleep, it always 
(10 trys, no fail) passes, but 2 seconds of sleeping is alot of wall 
time wasted. If I remove the sleep(1) from the child proc, it always 
fails (10 fails out of 10 trys). If I put a sleep(1) at the accept, 
remove the sleep(1) at the child (child does not sleep), 10 passes out 
of 10 trys. This sockets/unix IO/unix events stuff I am not very 
familiar with, so I dont know how to fix it.

[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=library
    severity=medium
    module=IO
---
Site configuration information for perl 5.19.0:

Configured by Administrator at Sun May 19 19:59:16 2013.

Summary of my perl5 (revision 5 version 19 subversion 0 patch blead 
2013-05-19.21:05:35 bb003204009d113d60d4173c3ed72b10c8169f14 
v5.18.0-25-gbb00320) configuration:
  Snapshot of: bb003204009d113d60d4173c3ed72b10c8169f14
  Platform:
    osname=MSWin32, osvers=5.2, archname=MSWin32-x86-multi-thread
    uname=''
    config_args='undef'
    hint=recommended, useposix=true, d_sigaction=undef
    useithreads=define, usemultiplicity=define
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=undef, use64bitall=undef, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cl', ccflags ='-nologo -GF -W3 -O1 -MD -Zi -DNDEBUG -GS- -GL 
-DWIN32 -D_CONSOLE -DNO_STRICT -D_CRT_SECURE_NO_DEPRECATE 
-D_CRT_NONSTDC_NO_DEPRECATE  -DPERL_TEXTMODE_SCRIPTS 
-DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO',
    optimize='-O1 -MD -Zi -DNDEBUG -GS- -GL',
    cppflags='-DWIN32'
    ccversion='15.00.30729.01', gccversion='', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=8
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='__int64', 
lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='link', ldflags ='-nologo -nodefaultlib -debug -opt:ref,icf 
-ltcg  -libpath:"c:\p519\lib\CORE"  -machine:x86'
    libpth=\lib
    libs=oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib  
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib  
netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib  version.lib 
odbc32.lib odbccp32.lib comctl32.lib msvcrt.lib
    perllibs=oldnames.lib kernel32.lib user32.lib gdi32.lib 
winspool.lib  comdlg32.lib advapi32.lib shell32.lib ole32.lib 
oleaut32.lib  netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib  
version.lib odbc32.lib odbccp32.lib comctl32.lib msvcrt.lib
    libc=msvcrt.lib, so=dll, useshrplib=true, libperl=perl519.lib
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug 
-opt:ref,icf -ltcg  -libpath:"c:\p519\lib\CORE"  -machine:x86'

Locally applied patches:
    

---
@INC for perl 5.19.0:
    C:/p519/site/lib
    C:/p519/lib
    .

---
Environment for perl 5.19.0:
    CYGWIN=tty
    HOME (unset)
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    
PATH=C:\p519\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program 
Files (x86)\Microsoft Visual Studio 9.0\VC\bin;C:\Program Files 
(x86)\Microsoft Visual Studio 9.0\VC;C:\Program Files\TortoiseGit\bin
    PERL_BADLANG (unset)
    SHELL (unset)


Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About