glenfant / stopit

Raise asynchronous exceptions in other thread, control the timeout of blocks or callables with a context manager or a decorator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Not working with gunicorn + gevent workers

anshulk opened this issue · comments

I'm trying to use the threading_timeoutable decorator on a function.
It works if I run the script directly, but doesn't work when running via gunicorn using gevent workers.

Any ideas on making it work?

Hi @anshulk , the theading part of stopit is designed for standard CPython threading inners.
I'm not familiar with gevent plumbing, but I suspect you should tailor the async_raise function to the inners of gunicorn/gevent. AFAIK gevent monkey patches lots of Python stdlib low level APIs.

Hi @anshulk , I have still no fix for this issue. As long as there's no PR that fixes this, I'll mention this in a "known issues" section of the doc, and close this.

This also seems to affect gunicorn's sync workers, not just gevent workers.
I know, this is closed as wontfix; just leaving that here in case someone else comes along and thinks it only applies to gevent workers, based on the title.

Thanks @jrial , I'll mention this too.
Any PR that fixes this bug or test case that shows it is welcome.