Maya hard crashes when using a QThread + HTTP requests

178 views
Skip to first unread message

Salvador Olmos Miralles

unread,
Sep 27, 2019, 7:15:04 AM9/27/19
to Python Programming for Autodesk Maya
Hello everyone!

I've been having some issues lately with Maya and QThread that I hope someone can help me, because I surely don't have any idea why that would be.

The crash I'm having is another variant of what Viktor Petrov asked here, a sudden crash with no dialog or warning, just Maya closing unexpectedly. Inside of Maya I'm using a QThread that queries some data through HTTP requests (in my case specifically, this is done by the Ftrack API) and emits the result as a string through a signal. This tool works on Nuke as well and so far our Nuke users have not reported any issues of this kind.

The crashes seem random but constant. There are no traceback or errors. I've gotten a process dump on the moment of the crash but to be honest either I don't know how to interpret it or it really doesn't help.

I've also tried to switch to QRunnable + QThreadPool but doesn't solve the issue either. All data is interchanged as a string and I'm using a queue.Queue instance which should be thread safe. There is a small delay between the thread starting and the crash which leads me to think that the reason is either the result signal or the HTTP request itself.

Is there any special precautions to use when dealing with QThread + HTTP requests in Maya?

This is a slightly modified version of the code I'm using:


This is the code called from the main process, requestData is called to start a job and onThreadJobFinished is the callback when the thread finishes. The events have a unique ID to make sure no python object is sent to the thread, but that didn't solve the issue either.



I'm using Maya 2019, PySide2 - 2.0.0~alpha0, Qt - 5.6.1.

Thanks,
Salvador.

Justin Israel

unread,
Sep 27, 2019, 3:52:39 PM9/27/19
to python_in...@googlegroups.com
One of our engineers at Weta found a bug in the combination of Python threads and Qt (both PySide and PyQt). You could see if your crash dump report looks similar.


It was also a patch that was was submitted to the python runtime. 

Teijo actually just gave a talk about it at Kiwi Pycon:


--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/14ed2c93-fea5-4293-a45d-14041aa5e1af%40googlegroups.com.

Salvador Olmos Miralles

unread,
Oct 19, 2019, 8:15:04 AM10/19/19
to Python Programming for Autodesk Maya
That was incredibly helpful. Thank you and your colleague for that.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages