Author Ringding
Recipients Ringding
Date 2013-01-31.21:39:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
After a fork, the list of thread states contains all the threads from before. It is especially unfortunate that, at least for me, it usually happens that threads created in the forked process reuse the same thread ids, and sys._current_frames will then return wrong stack frames for existing threads because the old entries occur towards the tail of the linked list and overwrite the earlier, correct ones, in _PyThread_CurrentFrames.

The attached patch is certainly not the most complete solution, but it solves my problem.

With Python 2.7.3 I get:

Exception in thread Thread-6:
Traceback (most recent call last):
  File "/usr/lib64/python2.7/", line 551, in __bootstrap_inner
  File "/usr/lib64/python2.7/", line 504, in run
    self.__target(*self.__args, **self.__kwargs)
  File "", line 24, in do_verify
    assert frame_from_sys is real_frame

With my patch applied, it passes silently. I can reproduce this on CentOS 6.3 x86_64 as well as Fedora 18 x86_64.
Date User Action Args
2013-01-31 21:39:23Ringdingsetrecipients: + Ringding
2013-01-31 21:39:23Ringdingsetmessageid: <>
2013-01-31 21:39:23Ringdinglinkissue17094 messages
2013-01-31 21:39:23Ringdingcreate