This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients vstinner
Date 2011-04-18.20:17:58
SpamBayes Score 4.95818e-05
Marked as misclassified No
Message-id <>
test_3_join_in_forked_from_thread() of test_threading failed on "x86 Ubuntu Shared 3.x" buildbot:
[201/354] test_threading
[41179 refs]
[40407 refs]
[40407 refs]
[40407 refs]
Timeout (1:00:00)!
Thread 0x404218c0:
  File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/", line 466 in _eintr_retry_call
  File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/", line 1486 in _try_wait
  File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/", line 1528 in wait
  File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/", line 455 in _run_and_join
  File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/", line 518 in test_3_join_in_forked_from_thread
  File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/unittest/", line 387 in _executeTestPart
  File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/unittest/", line 442 in run
  File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/unittest/", line 494 in __call__
  File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/unittest/", line 105 in run
  File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/unittest/", line 67 in __call__
  File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/unittest/", line 105 in run
  File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/unittest/", line 67 in __call__
  File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/", line 1078 in run
  File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/", line 1166 in _run_suite
  File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/", line 1192 in run_unittest
  File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/", line 728 in test_main
  File "./Lib/test/", line 1041 in runtest_inner
  File "./Lib/test/", line 835 in runtest
  File "./Lib/test/", line 659 in main
  File "./Lib/test/", line 1619 in <module>
make: *** [buildbottest] Error 1
program finished with exit code 2

Code of the test:
    def _run_and_join(self, script):
        script = """if 1:
            import sys, os, time, threading

            # a thread, which waits for the main program to terminate
            def joiningfunc(mainthread):
                print('end of thread')
                # stdout is fully buffered because not a tty, we have to flush
                # before exit.
        \n""" + script

        p = subprocess.Popen([sys.executable, "-c", script], stdout=subprocess.PIPE)
        rc = p.wait() <~~~ HANG HERE ~~~~
        data ='\r', '')
        self.assertEqual(data, "end of main\nend of thread\n")
        self.assertFalse(rc == 2, "interpreter was blocked")
        self.assertTrue(rc == 0, "Unexpected error")

    @unittest.skipUnless(hasattr(os, 'fork'), "needs os.fork()")
    def test_3_join_in_forked_from_thread(self):
        # Like the test above, but fork() was called from a worker thread
        # In the forked process, the main Thread object must be marked as stopped.

        # Skip platforms with known problems forking from a worker thread.
        # See
        if sys.platform in ('freebsd4', 'freebsd5', 'freebsd6', 'netbsd5',
            raise unittest.SkipTest('due to known OS bugs on ' + sys.platform)
        script = """if 1:
            main_thread = threading.current_thread()
            def worker():
                childpid = os.fork()
                if childpid != 0:
                    os.waitpid(childpid, 0)

                t = threading.Thread(target=joiningfunc,
                print('end of main')
                t.join() # Should not block: main_thread is already stopped

            w = threading.Thread(target=worker)
Date User Action Args
2011-04-18 20:18:01vstinnersetrecipients: + vstinner
2011-04-18 20:18:00vstinnersetmessageid: <>
2011-04-18 20:17:59vstinnerlinkissue11870 messages
2011-04-18 20:17:58vstinnercreate