Skip to content
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

About gunicorn [CRITICAL] Worker Timeout #1965

Closed
skytoup opened this issue Jan 23, 2019 · 5 comments · Fixed by #1967
Closed

About gunicorn [CRITICAL] Worker Timeout #1965

skytoup opened this issue Jan 23, 2019 · 5 comments · Fixed by #1967

Comments

@skytoup
Copy link
Contributor

skytoup commented Jan 23, 2019

Recently, I found that my worker appears timeout at about 9 o 'clock every day.

Finally, one day I found that when the system time was modified (more than the current time), the worker unexpectedly appeared timeout! At this time, I can confirm that the daily worker timeout is caused by time synchronization.

I checked the relevant source code and found that the system time was used to determine whether the worker was timeout.

if time.time() - worker.tmp.last_update() <= self.timeout:

@tilgovi
Copy link
Collaborator

tilgovi commented Jan 23, 2019

This probably cannot be fixed right now. The workers chmod a temporary file to mark liveness so it's not possible to use a monotonic time there.

The best workaround is probably to use a time daemon that handles smoothing the system clock changes.

@benoitc
Copy link
Owner

benoitc commented Jan 23, 2019 via email

@tilgovi
Copy link
Collaborator

tilgovi commented Jan 23, 2019

Maybe it would work. I am reading now that os.utime supports a file descriptor argument for Python 3.3+, so we could use it on the worker temp files.

https://docs.python.org/3/library/os.html#os.utime

We could set the time using time.monotonic and I think it might work!

@tilgovi
Copy link
Collaborator

tilgovi commented Jan 23, 2019

@skytoup do you want to try to make a patch?

@skytoup
Copy link
Contributor Author

skytoup commented Jan 23, 2019

@skytoup do you want to try to make a patch?
--
Refer to your suggestion and make this patch(#1967).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants