python-manhole icon indicating copy to clipboard operation
python-manhole copied to clipboard

fix crash in some rare eventlet edge cases

Open anarcat opened this issue 7 months ago • 3 comments

Closes: #70

anarcat avatar May 29 '25 16:05 anarcat

I am not really a fan of this approach of ignoring attribute errors and I think in the future it will create more problem than it solves.

Now looking at the traceback I wonder if this problem is not simply caused by manhole trying to import eventlet too eagerly. Would having a check in sys.modules for eventlet (eg: only try to import it if it was already imported) solve your problem? Shouldn't need to import eventlet/gevent if they didn't patch anything anyway (eg: them not being in sys.modules means we get the original stuff). Can you try this approach?

ionelmc avatar Jun 02 '25 09:06 ionelmc

Now looking at the traceback I wonder if this problem is not simply caused by manhole trying to import eventlet too eagerly. Would having a check in sys.modules for eventlet (eg: only try to import it if it was already imported) solve your problem? Shouldn't need to import eventlet/gevent if they didn't patch anything anyway (eg: them not being in sys.modules means we get the original stuff). Can you try this approach?

Makes sense, will give that a shot.

anarcat avatar Jun 02 '25 13:06 anarcat

i tried that, let me know if it's what you think. i don't have any gevent or eventlet code here to test this path, but the "normal" path works with this.

anarcat avatar Jun 02 '25 13:06 anarcat