Resource Temporarily Unavailable workaround

Christopher Faylor
Fri Nov 23 00:22:00 GMT 2007

On Thu, Nov 22, 2007 at 05:55:05PM +0000, Andrew STUBBS wrote:
>Christopher Faylor wrote:
>>On Thu, Nov 22, 2007 at 12:00:51PM -0500, Christopher Faylor wrote:
>>>On Thu, Nov 22, 2007 at 04:41:54PM +0000, Andrew STUBBS wrote:
>>>>The attached patch adds a 'retry' to the fork system call.  Basically
>>>>it waits 10 seconds to allow the 'resource temporarily unavailable' to
>>>>become (temporarily) available once more, and tries again, up to a
>>>>maximum of three attempts.
>>>There is already a retry in the fork and spawn system calls.  This
>>>technique has proved to be problematic since it can mask problems and
>>>you can end up with situations where a process starts successfully but
>>>cygwin thinks it fails and restarts the process again.  For the exec
>>>case, there is also a problem with non-cygwin .exes.
>>>If you look for retry in the fork call you should see where this is
>>>supposed to be happening.
>>Btw, it is likely that if you are seeing this problem that there is
>>something happening after the retry code in fork which is causing an
>>EAGAIN.  The existing retry code could be expanded to take that into
>>account if that is the case.
>Thanks, now I see the retry, but the code is impossible to follow
>without knowing both Cygwin and Windows backwards, and I don't have
>that much time to spend on this.  :(
>Clearly its retries aren't (always) sufficient.  Perhaps it isn't
>retrying enough, or retrying the right stuff, or maybe not waiting long
>enough between retries.

Yes, that's why I typed the above "Btw," paragraph.

>Unfortunately the problem isn't easily reproducible.  I can't use
>strace as it runs way too slowly and I would just never get to the
>problem.  I could instrument the whole file up so that I can trace just
>that, and then sit back and wait.
>Any suggestions?

You could use printf's to find where it is failing.

But, really, that's a pretty obvious suggestion.  I'm not sure what
suggestions you're looking for if you can't find the time to learn
anything more about Cygwin or Windows.


More information about the Cygwin-patches mailing list