-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'I/O operation on closed file' on SIGHUP #863
Comments
Interestingly, I had the same issue, but at a random point in time:
gunicorn==19.1.1 |
I committed a fix in the branch #865 . Please review. |
Hey @benoitc et al., any idea when will we get a release that has this fix in it? |
I will make a minor release tomorrow :) |
Thanks @benoitc that would awesome. 👍 |
Hey @benoitc I don't see it on PyPI quite yet. Just a friendly reminder. |
@benoitc, looking forward to the new release. This bug is very severe for high volume apps that aggressively recycle workers. In the interm, I'm working around by applying a monkey patch - but that doesn't feel good. |
Sorry i was too much busy to prepare the release, but I will tomorrow. |
@benoitc, I've been testing the patch (applied via monkey) and it doesn't seem to completely fix the problem. My app still managed to crash with a stack trace like:
I think the except block in the sleep() needs to ignore OSError in addition to ValueError. I spent some time trying to figure out how this could happen and my best guess is that there is still a race condition caused by the signal handler for SIGCHLD, which calls worker.tmp.close() in reap_workers(). If the signal handler is called before/during sleep() then WorkerTmp.last_update() will throw "OSError: [Errno 9] Bad file descriptor" when it calls os.fstat() on a file descriptor that doesn't exist. But this seems like it'd be the same race condition that caused the ValueError reported in this bug. In the OS closing a file descriptor is atomic but in python maybe there's two steps and you get a different exception depending on your exact timing. |
@nbaggott are you under Python 3? |
@benoitc python 2.6 |
I need this fix, when is the next release? Thank you. |
Ping. |
release is planned tomorrow, sorry for the delay. |
Thank you @benoitc . |
@benoitc Hi! I'm waiting for this release too. Are there any plans to release soon? Thank you! |
Sorry, I may have been holding this up with review of an issue with the On Wed, Jan 14, 2015, 14:50 Nadya notifications@github.com wrote:
|
I can confirm this on python3.4/gunicorn 19.1.1
If there's anything I can do to help @tilgovi, let me know. |
if you can find the time, please roll a minor release for this issue. |
@minusf working on it. should be done tomorrow . |
I met this problem too , why does it happen ? ( python 2.7.5 , gunicorn 19.1.1 ) |
@olivetree123 the issue has been fixed in latest stable release. You should upgrade to the latest one. |
When the worker exited the tempfile is not available anymore so we can't get the last update and calculate the dynamic timeout introduced in d76bab4 . This changes fix it by catching the IO error. fix benoitc#863
The fix for issue benoitc#863 was incomplete as both OSError or ValueError could be raised by os.fstat(). Thus we need to catch both types of exceptions
When the worker exited the tempfile is not available anymore so we can't get the last update and calculate the dynamic timeout introduced in d76bab4 . This changes fix it by catching the IO error. fix benoitc#863
The fix for issue benoitc#863 was incomplete as both OSError or ValueError could be raised by os.fstat(). Thus we need to catch both types of exceptions
The text was updated successfully, but these errors were encountered: