>> The GIL is likely held by a different thread, then. >> _PyThreadState_Current will point to the state of this other thread. > > I tested when the GIL released: the fault handler is unable to retrieve "the" > thread state and so the backtrace is not printed. Which thread state should > be > retrieve? I don't know yet: maybe the last active thread state? > > It doesn't look trivial to fix this issue because if there is no thread (only > the main thread), release the GIL clears the thread state pointer (to it to > NULL) without storing it somewhere else (whereas with multiple threads, the > last active thread is stored in "gil_last_holder". I should ask Antoine (or > someone one) how the new GIL works.
I don't think this is possible to fix. Just put a sleep() call before the crash, and have a parallel thread perform a while-loop to see what I mean: it should give you a stack trace of the wrong thread, possibly touching transient objects which go away while you inspect them. > Another variable might be created to store the (pointer to the) last active > thread state. Please understand: the last active thread may not be the one that got the signal. Instead, it may be another thread that keeps running while your thread crashes. Regards, Martin _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com