Replies: 2 comments 3 replies
-
What do you mean by "crash"? Assuming you mean "throw a Python exception" why can you not trap the exception and terminate the function? If you mean that it blocks (goes into an infinite loop) then you need to subject it to a timeout. It's hard to say how to implement the timeout without knowing exactly where the blocking occurs. |
Beta Was this translation helpful? Give feedback.
-
Thanks @peterhinch |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have an http request handler thread that from time to time receives bad requests that cause it to crash. I've done what I can to handle certain malformed requests but there's always more than what I have currently seen. So I wonder if the main thread can detect whether the http request handler thread has stopped running so it could either restart the thread or reboot. The current doc has no info on _thread which it says is highly experimental. It refers to CPython doc and I don't know if there is a way to detect thread running or stopped. CPython seems to have higher-level threading module that has is_alive() etc but not lower-level _thread functions.
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions