public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Cygwin bash for loops : repeated errors : [main] bash 1972 fork: child -1 - CreateProcessW failed for <bash.exe> errno 9 bash: fork: Bad file descriptor
@ 2015-09-23  7:52 litter
  2015-09-23  9:15 ` Marco Atzeri
  0 siblings, 1 reply; 8+ messages in thread
From: litter @ 2015-09-23  7:52 UTC (permalink / raw)
  To: cygwin

Hi all,

On a Windows XP 32 bit machine with latest Cygwin installed
(CYGWIN_NT-5.1 <machine> 2.2.1(0.289/5/3) 2015-08-20 11:40 i686 Cygwin)
I frequently encounter errors which break bash while loops, making it practically unusable

e.g.
cat some-file | while read i;do grep text $i;done

results in
2 [main] bash 1972 fork: child -1 - CreateProcessW failed for '<cygwin install path>\bin\bash.exe', errno 9
bash: fork: Bad file descriptor

The error is unpredictable, in a next run everything can run fine again.

I already checked for some common errors, but could not find anything.

Any help is appreciated.

Thanks,
Paul

--
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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Cygwin bash for loops : repeated errors : [main] bash 1972 fork: child -1 - CreateProcessW failed for <bash.exe> errno 9 bash: fork: Bad file descriptor
  2015-09-23  7:52 Cygwin bash for loops : repeated errors : [main] bash 1972 fork: child -1 - CreateProcessW failed for <bash.exe> errno 9 bash: fork: Bad file descriptor litter
@ 2015-09-23  9:15 ` Marco Atzeri
  2015-09-23 15:03   ` litter
  0 siblings, 1 reply; 8+ messages in thread
From: Marco Atzeri @ 2015-09-23  9:15 UTC (permalink / raw)
  To: cygwin



On 23/09/2015 09:52, litter@null.net wrote:
> Hi all,
>
> On a Windows XP 32 bit machine with latest Cygwin installed
> (CYGWIN_NT-5.1 <machine> 2.2.1(0.289/5/3) 2015-08-20 11:40 i686 Cygwin)
> I frequently encounter errors which break bash while loops, making it practically unusable
>
> e.g.
> cat some-file | while read i;do grep text $i;done
>
> results in
> 2 [main] bash 1972 fork: child -1 - CreateProcessW failed for '<cygwin install path>\bin\bash.exe', errno 9
> bash: fork: Bad file descriptor
>
> The error is unpredictable, in a next run everything can run fine again.
>
> I already checked for some common errors, but could not find anything.
>
> Any help is appreciated.
>
> Thanks,
> Paul
>

It seems a race problem, due to the repetitive fork of grep
for every line of some-file

I suggest to rethink the command.

   awk '{if ($1 ~ /text/) print $1}' some-file

Regards
Marco

--
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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Cygwin bash for loops : repeated errors : [main] bash 1972 fork: child -1 - CreateProcessW failed for <bash.exe> errno 9 bash: fork: Bad file descriptor
  2015-09-23  9:15 ` Marco Atzeri
@ 2015-09-23 15:03   ` litter
  2015-09-23 15:56     ` Marco Atzeri
  0 siblings, 1 reply; 8+ messages in thread
From: litter @ 2015-09-23 15:03 UTC (permalink / raw)
  To: cygwin

> It seems a race problem, due to the repetitive fork of grep
> for every line of some-file

So why does it fail? Seems like a bug to me!

Regards,
Paul

--
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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Cygwin bash for loops : repeated errors : [main] bash 1972 fork: child -1 - CreateProcessW failed for <bash.exe> errno 9 bash: fork: Bad file descriptor
  2015-09-23 15:03   ` litter
@ 2015-09-23 15:56     ` Marco Atzeri
  2015-09-24  9:51       ` litter
  0 siblings, 1 reply; 8+ messages in thread
From: Marco Atzeri @ 2015-09-23 15:56 UTC (permalink / raw)
  To: cygwin

On 23/09/2015 17:03, litter@null.net wrote:
>> It seems a race problem, due to the repetitive fork of grep
>> for every line of some-file
>
> So why does it fail? Seems like a bug to me!
>
> Regards,
> Paul

As does not fail on my computer, I suspect is a race between your AV and 
cygwin and sometimes cygwin wins.


Regards
Marco


--
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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Cygwin bash for loops : repeated errors : [main] bash 1972 fork: child -1 - CreateProcessW failed for <bash.exe> errno 9 bash: fork: Bad file descriptor
  2015-09-23 15:56     ` Marco Atzeri
@ 2015-09-24  9:51       ` litter
  2015-09-24 10:10         ` Marco Atzeri
  0 siblings, 1 reply; 8+ messages in thread
From: litter @ 2015-09-24  9:51 UTC (permalink / raw)
  To: cygwin

.> On 23/09/2015 17:03, litter@null.net wrote:
>>> It seems a race problem, due to the repetitive fork of grep
>>> for every line of some-file
>>
>> So why does it fail? Seems like a bug to me!
>>
>> Regards,
>> Paul
> 
> As does not fail on my computer, I suspect is a race between your AV and 
> cygwin and sometimes cygwin wins.
> 
> 
> Regards
> Marco.

Good for you. I don't have AV SW as I mentioned. And even so, that still makes it a bug.

Anyhow, a suspicion is speculative. I thought this mailing list was meant to report issues, and I think this is an issue.
How can I further diagnose this? Is there a known way to further determine what's causing this?

Regards,
Paul

--
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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Cygwin bash for loops : repeated errors : [main] bash 1972 fork: child -1 - CreateProcessW failed for <bash.exe> errno 9 bash: fork: Bad file descriptor
  2015-09-24  9:51       ` litter
@ 2015-09-24 10:10         ` Marco Atzeri
  2015-09-30 11:16           ` litter
  0 siblings, 1 reply; 8+ messages in thread
From: Marco Atzeri @ 2015-09-24 10:10 UTC (permalink / raw)
  To: cygwin

On 24/09/2015 11:51, litter@null.net wrote:
> .> On 23/09/2015 17:03, litter@null.net wrote:
>>>> It seems a race problem, due to the repetitive fork of grep
>>>> for every line of some-file
>>>
>>> So why does it fail? Seems like a bug to me!
>>>
>>> Regards,
>>> Paul
>>
>> As does not fail on my computer, I suspect is a race between your AV and
>> cygwin and sometimes cygwin wins.
>>
>>
>> Regards
>> Marco.
>
> Good for you. I don't have AV SW as I mentioned. And even so, that still makes it a bug.

Your system timing performance as so poor that something
is likely interfering.
Don't assume that is a cygwin bug.

> Anyhow, a suspicion is speculative. I thought this mailing list was meant to report issues, and I think this is an issue.

Yes, this is the right place.

> How can I further diagnose this? Is there a known way to further determine what's causing this?

start with
 > Problem reports:       http://cygwin.com/problems.html

"Run cygcheck -s -v -r > cygcheck.out and include that file as an 
attachment in your report. Please do not compress or otherwise encode 
the output. Just attach it as a straight text file so that it can be 
easily viewed. "

so we can look at your system configuration.

> Regards,
> Paul

Marco

--
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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Cygwin bash for loops : repeated errors : [main] bash 1972 fork: child -1 - CreateProcessW failed for <bash.exe> errno 9 bash: fork: Bad file descriptor
  2015-09-24 10:10         ` Marco Atzeri
@ 2015-09-30 11:16           ` litter
  0 siblings, 0 replies; 8+ messages in thread
From: litter @ 2015-09-30 11:16 UTC (permalink / raw)
  To: cygwin

>>>>> It seems a race problem, due to the repetitive fork of grep
>>>>> for every line of some-file
>>>>
>>>> So why does it fail? Seems like a bug to me!
>>>>
>>>> Regards,
>>>> Paul
>>>
>>> As does not fail on my computer, I suspect is a race between your AV and
>>> cygwin and sometimes cygwin wins.
>>>
>>>
>>> Regards
>>> Marco.
>>
>> Good for you. I don't have AV SW as I mentioned. And even so, that still makes it a bug.
> 
> Your system timing performance as so poor that something
> is likely interfering.
> Don't assume that is a cygwin bug.
> 
>> Anyhow, a suspicion is speculative. I thought this mailing list was meant to report issues, and I think this is an issue.
> 
> Yes, this is the right place.
> 
>> How can I further diagnose this? Is there a known way to further determine what's causing this?
> 
> start with
>  > Problem reports:       http://cygwin.com/problems.html
> 
> "Run cygcheck -s -v -r > cygcheck.out and include that file as an 
> attachment in your report. Please do not compress or otherwise encode 
> the output. Just attach it as a straight text file so that it can be 
> easily viewed. "
> 
> so we can look at your system configuration.
> 
>> Regards,
>> Paul
> 
> Marco


After observing for a week on the system with the fix applied, I did not see this issue reoccur.
I do however still suspect that it is a bug in cygwin, indeed a race condition of some sorts, which probably becomes apparent when starting up a process takes (much) longer than expected.
As said, the guard32.dll is probably scanning the new CreateProcess candidate. I suspect that there's an timing assumption in the Cygwin fork code. But as I cannot be sure, I leave it at that.

Regards,
Paul

--
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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Cygwin bash for loops : repeated errors : [main] bash 1972 fork: child -1 - CreateProcessW failed for <bash.exe> errno 9 bash: fork: Bad file descriptor
@ 2015-10-01  7:03 Vermessung AVT - Wolfgang Rieger
  0 siblings, 0 replies; 8+ messages in thread
From: Vermessung AVT - Wolfgang Rieger @ 2015-10-01  7:03 UTC (permalink / raw)
  To: cygwin

Hi Paul,

I also get Bad File Descriptor errors, though in a quite different situation, see my recent topic "gawk: Bad File Descriptor error with concurrent readonly access to a network file" on Sep 25. There seems to be some issue in some file opening process that occurs with parallel processes and eventually concurrent file access (as in my case). May be the basic problem behind is similar to yours?

Kind regards,
Wolfgang


> After observing for a week on the system with the fix applied, I did not see this issue reoccur.
> I do however still suspect that it is a bug in cygwin, indeed a race condition of some sorts, which probably becomes
> apparent when starting up a process takes (much) longer than expected.
> As said, the guard32.dll is probably scanning the new CreateProcess candidate. I suspect that there's an timing
> assumption in the Cygwin fork code. But as I cannot be sure, I leave it at that.
>
> Regards,
> Paul


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-10-01  7:03 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-23  7:52 Cygwin bash for loops : repeated errors : [main] bash 1972 fork: child -1 - CreateProcessW failed for <bash.exe> errno 9 bash: fork: Bad file descriptor litter
2015-09-23  9:15 ` Marco Atzeri
2015-09-23 15:03   ` litter
2015-09-23 15:56     ` Marco Atzeri
2015-09-24  9:51       ` litter
2015-09-24 10:10         ` Marco Atzeri
2015-09-30 11:16           ` litter
2015-10-01  7:03 Vermessung AVT - Wolfgang Rieger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).