Open MatthewDaws opened 7 years ago
If there are any Python / tkinter
experts out there, I would of course prefer a better solution...
I've now verified that this seems to affect the latest Ubuntu release (so scorching hopes that it was due to me running an old linux install...)
On linux, it is quite easy to generate the following scary messages in the console:
To recreate this: do anything which displays a lot of graphs (e.g. run an analysis, then view it and click to view a lot of different days). I explored this and came up with a minimal example:
https://stackoverflow.com/questions/44781806/tkinter-objects-being-garbage-collected-from-the-wrong-thread
My belief is that it's caused by the garbage collector running on a thread different to the main GUI thread, and calling the
__del__
finaliser method on certaintk
objects which then causes the error, asTk
on linux seems strict about which thread it runs on. (On Windows, by adding logging to thetkinter
library code, I can verify that the same thing is happening; just there is not an ultimate error message, presumably becauseTk
on Windows is more tolerant of being called on the wrong thread).This seemed to be benign, but I have now observed it killing sub-processes: the symptom is that an analysis run will take forever to run, and before this, you'll notice that Python is only using
n-1
(orn-2
etc.) processes, instead of the usualn
(= number of cores on your machine).I have mitigated this by adding an explicit GC collection before critical points in the code.