-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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: hide segfault #2559
test: hide segfault #2559
Conversation
I can get this to trigger standalone, but it doesn't seem to trigger in pytest (locally too). I think it fails on exit, so number of times this runs may not matter, and that might be why pytest doesn't fail when it's not in a separate process. |
tests/test_gil_scoped.py
Outdated
@@ -97,3 +97,9 @@ def test_python_to_cpp_to_python_from_process(): | |||
def test_cross_module_gil(): | |||
"""Makes sure that the GIL can be acquired by another module from a GIL-released state.""" | |||
m.test_cross_module_gil() # Should not raise a SIGSEGV | |||
|
|||
|
|||
# Checks for segfault |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Attempts to generate non-deterministic Python 3.9 MacOS segfault.
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, though I probably will just pull this one experimental test; having our tests fail due to this, now that 3.9 is out, is probably not a good idea as long as we are actively trying to solve the issue. And this isn't breaking the tests anyway...
tests/test_gil_scoped.py
Outdated
|
||
|
||
# Checks for segfault | ||
def test_potential_segfault(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could port just this test to unittest
, so that I can run it with our sanitizers (ASAN, MSAN, TSAN).
Does that sound like a useful idea?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes yes yes! Just running it in plain Python does cause a segfault ~50% of the time (possibly regardless of the number of times it runs). There are no actual asserts here, so should be trivial to run.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(The single file I posted in the issue fails by itself if run directly; you just need to put it in the right place to load the cpp output module).
3818c49
to
261fc65
Compare
261fc65
to
2ac7cbd
Compare
Made this just not run the segfaulting tests, so we can see more green checkmarks. The bug is being investigated separately in #2559. |
I think the problem is more serious than first expected. The segfault happens when the process is cleaning up. For these examples, since it runs in a separate process, the return code of "-11" means the process segfaulted. But the thing causing the segfault can be other places, too, since this still segfaults at the end. I can try disabling the whole test, and hope that it's just that final test that's causing the issue. |
Trying to trigger segfault in main process. See #2558 .