--- In
hercules-390@..., Ivan Warren <ivan@...> wrote:
>
> However, if multiple threads attempt to simultaneously call the
> socketpair function in w32util.c, there is a time window for one or more
> of simultaneous attempts to fail if the 1st attempt hasn't completed its
> work. Apparently, I'd say a lock is in order here to serialize access to
> w32util.c[socketpair()].
>
> In hercules, you have a good chance of this happening if the
> connect/accept sequence is taking an unusual amount of time to complete
> (a firewall may cause this for example).
I tried forcing an unusual amount of time in order
to get a hard error.
But despite putting a 3 second pause in at the start
of socketpair, and a 3 second pause before the
"connect", it still has the same symptoms - ie fails
some of the time, works some of the time.
I don't have a theory that would explain that. With
the first 3 second pause, all other threads should
have either completed or blocked by then (unless
they're being triggered by timers?).
With the second 3 second pause, every socket/connect
sequence takes a long time, but Windows sometimes
doesn't seem to care.
Also, judging by my debug statements, I don't see
socketpair being called from multiple threads
simultaneously, even without your new lock.
BFN. Paul.
P.S. Here's 2 10-second delays, no locking:
socket_vector[0] = socket_vector[1] = INVALID_SOCKET;
sleep(10);
plus
sleep(10);
...
|| SOCKET_ERROR == connect( socket_vector[1],
C:\mvs380\jcl>runmvs mvsendec.jcl temp.txt
1 file(s) copied.
1 file(s) copied.
Hercules HET IEHINITT program Version 3.06:380-4.x
(c)Copyright 1999-2007 by Roger Bowler, Jan Jaeger, and others
Hercules HET IEHINITT program Version 3.06:380-4.x
(c)Copyright 1999-2007 by Roger Bowler, Jan Jaeger, and others
mvsendec.jcl
c:\mvs380\jcl\termherc.jcl
1 file(s) copied.
fred1
fred2
fred3
fred4
fred5
fred5.5
fred6
fred7
fred8
fred9
Hercules Version 3.06:380-4.x
(c)Copyright 1999-2007 by Roger Bowler, Jan Jaeger, and others
Built on Jun 28 2009 at 11:53:05
Build information:
Win32 (MSVC) build
Modes: S/370 S/380 ESA/390 z/Arch
Max CPU Engines: 8
Using fthreads instead of pthreads
Dynamic loading support
Loadable module default base directory is .
Using shared libraries
HTTP Server support
No SIGABEND handler
Regular Expressions support
Automatic Operator support
Machine dependent assists: cmpxchg1 cmpxchg4 cmpxchg8 fetch_dw store_dw
Running on PAUL-LAPTOP Windows_NT-6.0 i686 UP
Crypto module loaded (c) Copyright Bernard van der Helm, 2003-2008
Active: Message Security Assist
Message Security Assist Extension 1
Message Security Assist Extension 2
fred1
fred2
fred3
fred4
fred5
fred5.5
fred6
yaya2.5 No error
myflag 0
last 10049
stage3
yaya3 No error
1 file(s) copied.