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, zach.ware
Date 2018-06-05.22:17:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1528237076.41.0.592728768989.issue31731@psf.upfronthosting.co.za>
In-reply-to
Content
Hum, I succeeded to reproduce a hang in test_io using the command:

***
buildbot@stormageddon ~/python27 $ ./python -m test -v -m 'test_interrupted*' -F test_io
(...)
0:04:38 load avg: 3.36 [ 44] test_io
test_interrupted_write_buffered (test.test_io.CSignalsTest) ... ok
test_interrupted_write_text (test.test_io.CSignalsTest) ... ok
test_interrupted_write_unbuffered (test.test_io.CSignalsTest) ... ok
test_interrupted_write_buffered (test.test_io.PySignalsTest) ... ok
test_interrupted_write_text (test.test_io.PySignalsTest) ... ok
test_interrupted_write_unbuffered (test.test_io.PySignalsTest) ... ok

----------------------------------------------------------------------
Ran 6 tests in 6.167s

OK
0:04:45 load avg: 3.65 [ 45] test_io
test_interrupted_write_buffered (test.test_io.CSignalsTest) ... ok
test_interrupted_write_text (test.test_io.CSignalsTest) ... ok
test_interrupted_write_unbuffered (test.test_io.CSignalsTest) ... ok
test_interrupted_write_buffered (test.test_io.PySignalsTest) ... ok
test_interrupted_write_text (test.test_io.PySignalsTest) ... 
***

Traces in gdb of the stuck process:

***
(gdb) py-bt
Traceback (most recent call first):
  Waiting for the GIL
  <built-in method acquire of thread.lock object at remote 0xb6c09258>
  File "/buildbot/python27/Lib/threading.py", line 340, in wait
    waiter.acquire()
  File "/buildbot/python27/Lib/threading.py", line 940, in join
    self.__block.wait()
  File "/buildbot/python27/Lib/test/test_io.py", line 3161, in check_interrupted_write
    t.join()
  File "/buildbot/python27/Lib/test/test_io.py", line 3186, in test_interrupted_write_text
    self.check_interrupted_write("xy", b"xy", mode="w", encoding="ascii")
  File "/buildbot/python27/Lib/unittest/case.py", line 329, in run
    testMethod()
  File "/buildbot/python27/Lib/unittest/case.py", line 393, in __call__
    return self.run(*args, **kwds)
  File "/buildbot/python27/Lib/unittest/suite.py", line 108, in run
    test(result)
  File "/buildbot/python27/Lib/unittest/suite.py", line 70, in __call__
    return self.run(*args, **kwds)
  File "/buildbot/python27/Lib/unittest/suite.py", line 108, in run
    test(result)
  File "/buildbot/python27/Lib/unittest/suite.py", line 70, in __call__
    return self.run(*args, **kwds)
  File "/buildbot/python27/Lib/unittest/runner.py", line 151, in run
    test(result)
  File "/buildbot/python27/Lib/test/support/__init__.py", line 1535, in _run_suite
    result = runner.run(suite)
  File "/buildbot/python27/Lib/test/support/__init__.py", line 1626, in run_unittest
    _run_suite(suite)
  File "/buildbot/python27/Lib/test/test_io.py", line 3367, in test_main
    support.run_unittest(*tests)
  File "/buildbot/python27/Lib/test/regrtest.py", line 1236, in runtest_inner
    indirect_test()
  File "/buildbot/python27/Lib/test/regrtest.py", line 1044, in runtest
    return runtest_inner(test, verbose, quiet, huntrleaks, pgo, testdir)
  File "/buildbot/python27/Lib/test/regrtest.py", line 837, in local_runtest
    testdir=testdir)
  File "/buildbot/python27/Lib/test/regrtest.py", line 851, in main
    result = local_runtest()
  File "/buildbot/python27/Lib/test/regrtest.py", line 2025, in main_in_temp_cwd
    main()
  File "/buildbot/python27/Lib/test/__main__.py", line 3, in <module>
    regrtest.main_in_temp_cwd()
  File "/buildbot/python27/Lib/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/buildbot/python27/Lib/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)

(gdb) info threads
  Id   Target Id         Frame 
* 1    Thread 0xb7518700 (LWP 14442) "python" 0xb7772b49 in __kernel_vsyscall ()
  2    Thread 0xb6b36b40 (LWP 18865) "python" 0xb7772b49 in __kernel_vsyscall ()

(gdb) t 2
[Switching to thread 2 (Thread 0xb6b36b40 (LWP 18865))]
#0  0xb7772b49 in __kernel_vsyscall ()

(gdb) py-bt
Traceback (most recent call first):
  <built-in function read>
  File "/buildbot/python27/Lib/test/test_io.py", line 3141, in _read
    s = os.read(r, 1)
  File "/buildbot/python27/Lib/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/buildbot/python27/Lib/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/buildbot/python27/Lib/threading.py", line 774, in __bootstrap
    self.__bootstrap_inner()
***

And now I recall how much I hate this test. It made me crazy in Python 2 for a long time.

This specific test was my motiviation to add signal.pthread_sigmask() to Python 3.3.

Note: I also implemented the PEP 475 in Python 3.5 to make Python more reliable when getting signals.
History
Date User Action Args
2018-06-05 22:17:56vstinnersetrecipients: + vstinner, zach.ware
2018-06-05 22:17:56vstinnersetmessageid: <1528237076.41.0.592728768989.issue31731@psf.upfronthosting.co.za>
2018-06-05 22:17:56vstinnerlinkissue31731 messages
2018-06-05 22:17:56vstinnercreate