Can't Catch Error in Dramatiq worker and crashing the MainThread #227
GitHub issues are for bugs. If you have questions, please ask them on the discussion board.
What OS are you using?
What version of Dramatiq are you using?
What did you do?
While running a dramatiq actor that involves querying an elastic search instance on AWS a critical error occurs causing the dramatiq MainThread to crash. I try to catch the error in the worker as well as around the piece of code I believe is crashing but I am unable to catch the exception and therefore unable to tell what exactly is happening. I have checked that the environment variables are set correctly.
The code works when I perform a local query to elasticsearch on my computer, but it fails when trying to query a Elasticsearch cluster on AWS. However, I am able to run the code in the python terminal. It just fails in the dramatiq worker
What did you expect would happen?
I would expect to be able to catch the exception or at least have the exception surfaced by dramatiq so that I can see what is happening and debug it. If I was able to see what exception/error was occuring that would help me know what is going wrong when trying to access the AWS elasticsearch cluster
Received the following critical logging message, and then the MainThread is shut down killing all dramatiq workers
The text was updated successfully, but these errors were encountered:
That's a segmentation fault. Either your Python interpreter has a bug or some C module that you or the code you're using depends on does. I'm afraid there's not a ton I can do about this.
Things I would try:
@Bogdanp if you were at all curious the issue is related to a known issue with macOSX
From issue 30385
Interesting! Thanks. I develop
I plan to eventually let users either outright specify this as a flag or offer some kind of hook so they can run arbitrary code before the worker processes are created (enabling them to call that function w/o needing to modify
If I get some free time this week I can try and get a PR up that will allow user's to pass in a
I use Flask-dramatiq though, so I think a change might also be needed there for me to pass a such a flag
Just for prosperity sake, here's the stacktrace from the segmentation fault caused by
Add a `--spawn` flag to the cli that will allow a user to spawn processes instead of fork processes if they are on an OS that defaults to forking processes such as unix based machines. This started from a conversation on this issue Bogdanp#227 which showed the problem on unix(namely macOS) systems caused by forking processes.
Add a `--use-spawn` flag to the cli that will allow a user to spawn processes instead of fork processes if they are on an OS that defaults to forking processes such as unix based machines. This started from a conversation on this issue which showed the problem on unix(namely macOS) systems caused by forking processes. : #227