Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test_signal fails with interpreter crash #110772

Closed
Eclips4 opened this issue Oct 12, 2023 · 8 comments
Closed

test_signal fails with interpreter crash #110772

Eclips4 opened this issue Oct 12, 2023 · 8 comments
Labels
type-bug An unexpected behavior, bug, or error

Comments

@Eclips4
Copy link
Member

Eclips4 commented Oct 12, 2023

Bug report

Bug description:

./python.exe -m test -v test_signal

Traceback:

...many lines
test_stress_modifying_handlers (test.test_signal.StressTest.test_stress_modifying_handlers) ... Fatal Python error: Bus error

Current thread 0x000000016e333000 (most recent call first):
  File "/Users/admin/Projects/cpython/Lib/test/test_signal.py", line 1338 in set_interrupts
  File "/Users/admin/Projects/cpython/Lib/threading.py", line 1004 in run
  File "/Users/admin/Projects/cpython/Lib/threading.py", line 1067 in _bootstrap_inner
  File "/Users/admin/Projects/cpython/Lib/threading.py", line 1024 in _bootstrap

Thread 0x00000001e7601300 (most recent call first):
  File "/Users/admin/Projects/cpython/Lib/enum.py", line 1155 in __new__
  File "/Users/admin/Projects/cpython/Lib/enum.py", line 729 in __call__
Assertion failed: (PyCode_Check(f->f_executable)), function _PyFrame_GetCode, file pycore_frame.h, line 83.
Fatal Python error: Aborted

CPython versions tested on:

CPython main branch

Operating systems tested on:

macOS

@Eclips4 Eclips4 added the type-bug An unexpected behavior, bug, or error label Oct 12, 2023
@Eclips4
Copy link
Member Author

Eclips4 commented Oct 12, 2023

Bisected to 1e3460d

cc @gaogaotiantian @markshannon

@gaogaotiantian
Copy link
Member

gaogaotiantian commented Oct 12, 2023

Tried on my Linux (WSL) and x86 MacBook, won't reproduce. The test itself should not even execute the newly added code. The error seems weird too.

However, the ARM64 MacOS buildbot did seem to fail test_signal after this commit. It would be nice to narrow this down and see what could be the issue. For example, will it fail with ./python -m test test_signal -m test_stress_modifying_handlers

@Eclips4
Copy link
Member Author

Eclips4 commented Oct 12, 2023

Interesting. I no longer can reproduce it :(

Traceback:
./python.exe -m test test_signal -m test_stress_modifying_handlers --forever
Using random seed 1521715598
0:00:00 load avg: 2.52 Run tests sequentially
0:00:00 load avg: 2.52 [  1] test_signal
0:00:00 load avg: 2.52 [  2] test_signal
0:00:00 load avg: 2.52 [  3] test_signal
0:00:00 load avg: 2.52 [  4] test_signal
0:00:00 load avg: 2.52 [  5] test_signal
0:00:00 load avg: 2.52 [  6] test_signal
0:00:01 load avg: 2.52 [  7] test_signal
0:00:01 load avg: 2.52 [  8] test_signal
0:00:01 load avg: 2.52 [  9] test_signal
0:00:01 load avg: 2.52 [ 10] test_signal
0:00:01 load avg: 2.52 [ 11] test_signal
0:00:02 load avg: 2.52 [ 12] test_signal
0:00:02 load avg: 2.52 [ 13] test_signal
0:00:02 load avg: 2.52 [ 14] test_signal
0:00:02 load avg: 2.52 [ 15] test_signal
0:00:02 load avg: 2.39 [ 16] test_signal
0:00:02 load avg: 2.39 [ 17] test_signal
0:00:03 load avg: 2.39 [ 18] test_signal
0:00:03 load avg: 2.39 [ 19] test_signal
0:00:03 load avg: 2.39 [ 20] test_signal
0:00:03 load avg: 2.39 [ 21] test_signal
0:00:03 load avg: 2.39 [ 22] test_signal
0:00:04 load avg: 2.39 [ 23] test_signal
0:00:04 load avg: 2.39 [ 24] test_signal
0:00:04 load avg: 2.39 [ 25] test_signal
0:00:04 load avg: 2.39 [ 26] test_signal
Fatal Python error: Bus error

Current thread 0x000000016e20f000 (most recent call first):
  File "/Users/admin/Projects/cpython/Lib/test/test_signal.py", line 1338 in set_interrupts
  File "/Users/admin/Projects/cpython/Lib/threading.py", line 1004 in run
  File "/Users/admin/Projects/cpython/Lib/threading.py", line 1067 in _bootstrap_inner
  File "/Users/admin/Projects/cpython/Lib/threading.py", line 1024 in _bootstrap

Thread 0x00000001e7601300 (most recent call first):
  File "/Users/admin/Projects/cpython/Lib/enum.py", line 1128 in __new__
  File "/Users/admin/Projects/cpython/Lib/enum.py", line 729 in __call__
  File "/Users/admin/Projects/cpython/Lib/signal.py", line 29 in _int_to_enum
  File "/Users/admin/Projects/cpython/Lib/signal.py", line 57 in signal
  File "/Users/admin/Projects/cpython/Lib/test/test_signal.py", line 1346 in cycle_handlers
  File "/Users/admin/Projects/cpython/Lib/test/test_signal.py", line 1356 in test_stress_modifying_handlers
  File "/Users/admin/Projects/cpython/Lib/unittest/case.py", line 589 in _callTestMethod
  File "/Users/admin/Projects/cpython/Lib/unittest/case.py", line 636 in run
  File "/Users/admin/Projects/cpython/Lib/unittest/case.py", line 692 in __call__
  File "/Users/admin/Projects/cpython/Lib/unittest/suite.py", line 122 in run
  File "/Users/admin/Projects/cpython/Lib/unittest/suite.py", line 84 in __call__
  File "/Users/admin/Projects/cpython/Lib/unittest/suite.py", line 122 in run
  File "/Users/admin/Projects/cpython/Lib/unittest/suite.py", line 84 in __call__
  File "/Users/admin/Projects/cpython/Lib/unittest/suite.py", line 122 in run
  File "/Users/admin/Projects/cpython/Lib/unittest/suite.py", line 84 in __call__
  File "/Users/admin/Projects/cpython/Lib/test/support/testresult.py", line 146 in run
  File "/Users/admin/Projects/cpython/Lib/test/support/__init__.py", line 1163 in _run_suite
  File "/Users/admin/Projects/cpython/Lib/test/support/__init__.py", line 1290 in run_unittest
  File "/Users/admin/Projects/cpython/Lib/test/libregrtest/single.py", line 36 in run_unittest
  File "/Users/admin/Projects/cpython/Lib/test/libregrtest/single.py", line 92 in test_func
  File "/Users/admin/Projects/cpython/Lib/test/libregrtest/single.py", line 48 in regrtest_runner
  File "/Users/admin/Projects/cpython/Lib/test/libregrtest/single.py", line 95 in _load_run_test
  File "/Users/admin/Projects/cpython/Lib/test/libregrtest/single.py", line 138 in _runtest_env_changed_exc
  File "/Users/admin/Projects/cpython/Lib/test/libregrtest/single.py", line 238 in _runtest
  File "/Users/admin/Projects/cpython/Lib/test/libregrtest/single.py", line 266 in run_single_test
  File "/Users/admin/Projects/cpython/Lib/test/libregrtest/main.py", line 298 in run_test
  File "/Users/admin/Projects/cpython/Lib/test/libregrtest/main.py", line 333 in run_tests_sequentially
  File "/Users/admin/Projects/cpython/Lib/test/libregrtest/main.py", line 466 in _run_tests
  File "/Users/admin/Projects/cpython/Lib/test/libregrtest/main.py", line 497 in run_tests
  File "/Users/admin/Projects/cpython/Lib/test/libregrtest/main.py", line 661 in main
  File "/Users/admin/Projects/cpython/Lib/test/libregrtest/main.py", line 669 in main
  File "/Users/admin/Projects/cpython/Lib/test/__main__.py", line 2 in <module>
  File "/Users/admin/Projects/cpython/Lib/runpy.py", line 88 in _run_code
  File "/Users/admin/Projects/cpython/Lib/runpy.py", line 198 in _run_module_as_main

Extension modules: _testcapi (total: 1)
zsh: bus error  ./python.exe -m test test_signal -m test_stress_modifying_handlers --forever

@gaogaotiantian
Copy link
Member

I don't think test_stress_modifying_handlers could trigger the issue as the newly added code should not matter. It's possible that there's some dependency on other tests somehow clearing the interpreter states. I don't have any theories yet for what could happen (or if this is a real issue caused by this specific commit).

@gaogaotiantian
Copy link
Member

Okay let me see if I could repro on Linux.

@gaogaotiantian
Copy link
Member

I am able to repro this on my Mac on the commit before 1e3460d. So this is not introduced by the commit mentioned. (which makes sense because the only line of code committed is not executed during the test).

@chgnrdv
Copy link
Contributor

chgnrdv commented Oct 12, 2023

See also #110017 #110083

@Eclips4
Copy link
Member Author

Eclips4 commented Oct 13, 2023

I am able to repro this on my Mac on the commit before 1e3460d. So this is not introduced by the commit mentioned. (which makes sense because the only line of code committed is not executed during the test).

Yes, after some investigation I came to the same conclusions. Sorry for the false accusation.

See also #110017 #110083

Thanks! That's looks like duplicate of #110017.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

3 participants