Resource Temporarily Unavailable workaround
Thu Nov 22 17:55:00 GMT 2007
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.
There is quite a lot of stuff outside the "while (1)" that I assume is
the retried code. EAGAIN is mentioned a few times, and that's without
taking into account the contents of the various function calls. In
particular there's one comment that says "Hopefully, this will succeed."
- which is reassuring.
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.
More information about the Cygwin-patches