You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Test suite crashes when run single process --with-pydebug enabled #121832
The same failure can be manufactured on macOS with M1 hardware, as long as the test suite is executed as a single process (i.e. python -m test, not the multi-process option enabled by make test).
I have confirmed the crash is occurring in the SubInterpreterTest added as part of #121602. If that test is commented out, the test suite passes without error.
The gist is: the change in gh-121602 runtime initialization makes a copy of the (mostly) unmodified PyTypeObject struct for each builtin static type. During finalization we restore that copy, including the tp_version_tag. Clearly a part of that is causing things to get in an inconsistent state on iOS. The fix in gh-121636 restricts the copy/restore to only the "tp" slots (function pointers), restoring the pre-121602 status quo for the rest, including tp_version_tag.
Is there a way you could verify gh-121636 fixes the iOS build?
All that said, I'm definitely curious why this would be manifesting only on iOS?
FYI, I'm pretty sure gh-121636 will fix this.
...
Is there a way you could verify gh-121636 fixes the iOS build?
The iOS buildbot should be sufficient to verify any fix; from the look of it, the current state of #121636 doesn't fix it. The test failure isn't very helpful - it's a hard crash of the emulator, which the test report doesn't show very nicely - but with the test_types SubinterpreterTest commented out, the suite completes and passes on iOS. I've verified the same tests locally, and I get the same failure on #121636.
All that said, I'm definitely curious why this would be manifesting only on iOS?
You and me both :-)
My best guess right now it's not iOS specific, but a function of how the test suite is executed on iOS. iOS is forced to run the entire test suite sequentially in a single process. This isn't (AFAIK) the default mode of operation on any other runner; so it's possible the specific sequence of test execution is causing an odd state to emerge. One of the debugging tasks I'm going to look into today is to try and reproduce this on macOS (the other is to try and find a subset of tests that causes the failure, rather than needing to get to test_types alphabetically... after 20 minutes)
Confirming: the test_types test doesn't fail on macOS when the test suite is executed in single process mode, so the problem isn't purely about execution order. Now trying to bisect the test suite to find a smaller subset of tests that fail.
changed the title [-]iOS testbed crashes when `--with-pydebug` enabled[/-][+]Test suite crashes when run single process `--with-pydebug` enabled[/+]on Jul 17, 2024
Activity
freakboy3742 commentedon Jul 16, 2024
I've narrowed the cause of the crash to #121602 (which was backported to 3.13 as #121632, so it explains the failures on both branches).
freakboy3742 commentedon Jul 16, 2024
I have confirmed the crash is occurring in the SubInterpreterTest added as part of #121602. If that test is commented out, the test suite passes without error.
ericsnowcurrently commentedon Jul 16, 2024
FYI, I'm pretty sure gh-121636 will fix this.
The gist is: the change in gh-121602 runtime initialization makes a copy of the (mostly) unmodified
PyTypeObjectstruct for each builtin static type. During finalization we restore that copy, including thetp_version_tag. Clearly a part of that is causing things to get in an inconsistent state on iOS. The fix in gh-121636 restricts the copy/restore to only the "tp" slots (function pointers), restoring the pre-121602 status quo for the rest, includingtp_version_tag.Is there a way you could verify gh-121636 fixes the iOS build?
All that said, I'm definitely curious why this would be manifesting only on iOS?
freakboy3742 commentedon Jul 16, 2024
The iOS buildbot should be sufficient to verify any fix; from the look of it, the current state of #121636 doesn't fix it. The test failure isn't very helpful - it's a hard crash of the emulator, which the test report doesn't show very nicely - but with the test_types SubinterpreterTest commented out, the suite completes and passes on iOS. I've verified the same tests locally, and I get the same failure on #121636.
You and me both :-)
My best guess right now it's not iOS specific, but a function of how the test suite is executed on iOS. iOS is forced to run the entire test suite sequentially in a single process. This isn't (AFAIK) the default mode of operation on any other runner; so it's possible the specific sequence of test execution is causing an odd state to emerge. One of the debugging tasks I'm going to look into today is to try and reproduce this on macOS (the other is to try and find a subset of tests that causes the failure, rather than needing to get to test_types alphabetically... after 20 minutes)
ericsnowcurrently commentedon Jul 16, 2024
Looks like gh-121636 isn't sufficient. I'm going to try a different approach.
ericsnowcurrently commentedon Jul 16, 2024
See gh-121882.
freakboy3742 commentedon Jul 16, 2024
Dang it... looks like gh-121882 doesn't fix the problem either... 😢
freakboy3742 commentedon Jul 17, 2024
Confirming: the test_types test doesn't fail on macOS when the test suite is executed in single process mode, so the problem isn't purely about execution order. Now trying to bisect the test suite to find a smaller subset of tests that fail.
freakboy3742 commentedon Jul 17, 2024
Scratch that - it does crash on macOS - just you just have to remember to enable
--with-pydebug.@ericsnowcurrently To reproduce:
(Although I also had to patch
test_buildin.py::PtyTests.test_input_ttyto avoid a lockup due to #116402).Key details: Clean macOS build, with pydebug enabled; running as a single process (not multiprocess as
make testwill do), on an M1 MacBook Pro.Test failure:
Now trying to narrow down a subset of these tests that will fail.
[-]iOS testbed crashes when `--with-pydebug` enabled[/-][+]Test suite crashes when run single process `--with-pydebug` enabled[/+]16 remaining items
pythongh-121832: Skip subinterpreter static type check on iOS to rest…
markshannon commentedon Jul 23, 2024
@ericsnowcurrently can you make sure to revert #122150 when this is fixed?
[3.13] gh-121832: Skip subinterpreter static type check on iOS to res…
GH-121832: Assert that the version number of static builtin types is …
pythongh-121832: Skip subinterpreter static type check on iOS to rest…
pythonGH-121832: Assert that the version number of static builtin typ…
pythongh-121832: Skip subinterpreter static type check on iOS to rest…
pythonGH-121832: Assert that the version number of static builtin typ…
pythonGH-121832: Assert that the version number of static builtin typ…
[3.13] GH-121832: Assert that the version number of static builtin ty…
gh-121832: Revert test skip introduced by #122150. (#122340)
[3.13] pythongh-121832: Revert test skip introduced by pythonGH-122150.…
[3.13] gh-121832: Revert test skip introduced by GH-122150. (GH-122340)…