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: hide segfault #2559

Merged
merged 4 commits into from
Oct 8, 2020
Merged

test: hide segfault #2559

merged 4 commits into from
Oct 8, 2020

Conversation

henryiii
Copy link
Collaborator

@henryiii henryiii commented Oct 8, 2020

Trying to trigger segfault in main process. See #2558 .

  • tests: try to isolate segfault into one test
  • docs: minor typo caught by @rwgk

@henryiii
Copy link
Collaborator Author

henryiii commented Oct 8, 2020

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.

@@ -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
Copy link
Collaborator

@rwgk rwgk Oct 8, 2020

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.
?

Copy link
Collaborator Author

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...



# Checks for segfault
def test_potential_segfault():
Copy link
Collaborator

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?

Copy link
Collaborator Author

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.

Copy link
Collaborator Author

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).

@henryiii henryiii marked this pull request as ready for review October 8, 2020 13:14
@henryiii
Copy link
Collaborator Author

henryiii commented Oct 8, 2020

Made this just not run the segfaulting tests, so we can see more green checkmarks. The bug is being investigated separately in #2559.

@henryiii henryiii added this to the v2.6.0 milestone Oct 8, 2020
@henryiii
Copy link
Collaborator Author

henryiii commented Oct 8, 2020

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.

@henryiii henryiii merged commit deba040 into pybind:master Oct 8, 2020
@henryiii henryiii deleted the tests/hideseg branch October 8, 2020 16:25
@github-actions github-actions bot added the needs changelog Possibly needs a changelog entry label Oct 8, 2020
@henryiii henryiii removed the needs changelog Possibly needs a changelog entry label Oct 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants