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
Provide a way so that hub.destroy(destroy_loop=True) never blocks forever #1669
Comments
@jamadden I hate to "ping" you here (there probably is a reason for you haven't replied yet; and I truly appreciate all your maintenance/dev efforts on gevent!) -- but I would love to get a feeling for what your initial intuition about this topic is! |
I haven't had a chance to look at this. It will probably be awhile before I have any cycles to spare for this particular thing. |
Thank you @jamadden -- understood! As always: thanks for all your truly excellent efforts here. |
@jamadden I'll try that out soon. Thank you so much for getting back to this, and for connecting the dots. All my best wishes to you, and hope you have a good holiday time! |
Disclaimer: I only spent less than an hour on this problem so far and therefore didn't fully understand it yet. I would however already appreciate some early feedback!
#1601 led to #1604 and I appreciate the direction that this takes.
An intended side effect of this change seems to be that
hub.destroy(destroy_loop=True)
might now block forever.As part of my very brief initial inspection (see jgehrcke/gipc#103) the destroy() method would then hang in the
self.throw(GreenletExit)
call. Ahub.join()
prior to trying to callhub.destroy(destroy_loop=True)
would also block forever.I understand that this seems to be the new intended behavior, in the sense that callers of
hub.destroy()
are supposed to responsibly clean up resources prior to calling that very hub (and loop) destruction entry point.However, historically, within gipc the dirty trade-off was to not clean up, to put up with the fact that some orphaned resources might never get cleaned up after, but to nevertheless reliably destroy the old event loop.
That code has been around for a while, it's sitting here: https://github.com/jgehrcke/gipc/blob/c8125872fa263f93e920f3041cac2d51063c614c/gipc/gipc.py#L344
Now I would love to find a way to make gipc compatible with newer gevent versions.
Given the premise of gipc as a library it itself will not quite be able to implement generic, reliable cleanup gevent resources and therefore still needs a "brutal way" to create a new event loop in the child process, after forking. What can we do in gipc (or gevent) so that
hub.destroy(destroy_loop=True)
(or a variant of it) is guaranteed to not block forever? If this cannot quite be done within gipc (and I might have just not seen a way to achieve that) maybe we want to introduce another argument tohub.destroy()
via which the caller can explicitly require the dirty/brutal legacy approach (I kind of hate that, too, but...).The text was updated successfully, but these errors were encountered: