-
Notifications
You must be signed in to change notification settings - Fork 174
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
Prevent GreenletExit exceptions (and improve shutdown time) when shutting down with active keepalive connections #1009
Conversation
b9bfb35
to
a71cacd
Compare
This is expected to fail with the current Baseplate version.
a71cacd
to
593ceb4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm informed and this appears sensible -- excited to try it. I wouldn't consider my approval authoritative as I don't think I'd be able to foresee other issues this might cause.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ty! sorry for not re-reviewing quickly here |
Internal ticket: SVF-438
This fixes an issue where a Baseplate WSGI server in shutdown doesn't proactively close existing "keepalive" connections and continues to process requests from them. This causes two issues:
GreenletExit
if the server'sstop_time
is reached.This fix causes gevent to close connections once a server begins graceful shutdown (i.e. once
server.stop()
is called). It does this by adding theConnection: close
header on responses and by closing connections in the pool.Commentary
There doesn't appear to be an easy way to fix this without subclassing gevent's
WSGIHandler
and/orWSGIServer
classes. These classes are designed to be subclassed according to the documentation, though it would still be better to fix this in gevent.I believe most gevent users don't hit this as it is fairly rare (and not recommended) to use gevent's built-in WSGI server instead of something like gunicorn.
I've emailed the gevent mailing list to ask about this issue. If the reception is positive I'll submit a patch upstream.
Validation
develop
branch).