X-Recipient: archive-cygwin@delorie.com
X-Spam-Check-By: sourceware.org
Date: Tue, 7 Dec 2010 10:55:58 -0500
From: Christopher Faylor <cgf-use-the-mailinglist-please@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: Problem with fork() in latest snapshot
Message-ID: <20101207155558.GC25822@ednor.casa.cgf.cx>
Reply-To: cygwin@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
References: <4CDAF5D0.8080306@budcat.com> <20101116154141.GA32170@calimero.vinschen.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20101116154141.GA32170@calimero.vinschen.de>
User-Agent: Mutt/1.5.20 (2009-06-14)
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
Precedence: bulk
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

On Tue, Nov 16, 2010 at 04:41:41PM +0100, Corinna Vinschen wrote:
>On Nov 10 13:43, Heath Kehoe wrote:
>> I have ruby 1.9.2 which I built from source. It works fine in cygwin
>> 1.7.7 and earlier, but in the current snapshot when it does a fork,
>> the child process dies pretty much instantly.
>> 
>> I've put together a test case (see attached) which replicates what
>> ruby is doing so that this problem can be repro'd without needing to
>> build ruby. It seems that the failure only happens when the fork
>> call is in a dll, and it also seems to depend on manipulating
>> threads in close proximity to the fork.
>> 
>> Here's the test program under 1.7.7:
>> 
>>    $ uname -a
>>    CYGWIN_NT-6.1-WOW64 hkehoe1 1.7.7(0.230/5/3) 2010-08-31 09:58 i686
>>    Cygwin
>>    $ ./testfork
>>    Before fork
>>    After fork pid=5060
>>    After fork pid=0
>>    subprocess status 0 (0x0)
>> 
>> And here it is in the snapshot:
>> 
>>    $ uname -a
>>    CYGWIN_NT-6.1-WOW64 hkehoe1 1.7.8s(0.233/5/3) 20101102 14:03:08 i686
>>    Cygwin
>>    $ ./testfork
>>    Before fork
>>    After fork pid=3808
>>    subprocess status 32512 (0x7f00)
>> 
>> 
>> Note the missing 'After fork' message from the child and the -127
>> exit status.
>> 
>> An strace of testfork will reveal this error occurring shortly after
>> the fork returns in the child:
>> --- Process 2944, exception C0000005 at 610E4B8C
>> (the process ID is the child's)
>
>Would you mind to test which snapshot introduced this problem?

I ran the test case in a loop on my Windows XP system under various conditions -
no load, load, no load with most services stopped.  I couldn't reproduce the
problem.

I also tried on a virtual system running Windows 7 64-bit and couldn't duplicate
it.

So, I'm currently stumped.  I guess I'll try to add some instrumentation to catch
the case where this fails.

cgf

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

