This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: hang when using pthread and fork in 1.5.23-1 and snapshot 20070118, and now 1.5.24-1.


On Fri, 26 Jan 2007, Peter Rehley wrote:

> Hello,
>
> I tried the latest release of cygwin1.dll (1.5.24-1) and it still is
> hanging in the same way.  I've tried to debug further with gdb, but
> so far I haven't got any useful information out of gdb.
>
> I'll keep trying to get some debug information, but if any one else
> can reproduce the problem I would be most appreciative.

I can reproduce a problem.  Your descriptions of it are a bit hard to
follow, so I'm not sure if it is your problem or not.  Unfortunately, I
don't have time to debug it right now.  I do have a few comments, though.

Why are you creating a thread just to fork/exec another process?

Pedantically, I believe you are supposed to call _exit, not exit, if fork
fails as stated here in the Solaris man page for fork:

     An applications should call _exit() rather than exit(3C)  if
     it  cannot execve(), since exit() will flush and close stan-
     dard I/O channels and thereby corrupt the  parent  process's
     standard I/O data structures. Using exit(3C) will flush buf-
     fered data twice. See exit(2).

I don't know, however, if this is really true in Cygwin, but it might
explain some misdiagnosed hangs on your part.

Also, the execve call appears to be suspect.  Again, the Solaris man page
for execve states:

     The value in
     argv[0] should point to a filename that is  associated  with
     the process being started by one of the exec functions.
[snip]
     As indicated, argc is at least one and the
     first member of the array points to a string containing  the
     name of the file.

Attached is a modified test case that fixes a few of these issues, but
still hangs (or stutters; it does appear to proceed after long periods of
time).

-- 
Brian Ford
Lead Realtime Software Engineer
VITAL - Visual Simulation Systems
FlightSafety International
the best safety device in any aircraft is a well-trained crew...

Attachment: main.cc
Description: Text document

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]