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

Segmentation fault in Python 3.7 #103

Open
AvnerCohen opened this issue Oct 28, 2019 · 6 comments
Open

Segmentation fault in Python 3.7 #103

AvnerCohen opened this issue Oct 28, 2019 · 6 comments

Comments

@AvnerCohen
Copy link

Seething this crash, full report in here:
pytest-dev/pytest#3672
Once snapshottest is uninstalled (even of not in use, as in the example provided) this does not happen.

Very easy to recreate. Any thoughts? or anything I can provide or test?

$ pytest  --assert=plain moshe.py
=========================================================================================== test session starts ============================================================================================
platform linux -- Python 3.7.4, pytest-5.2.2, py-1.8.0, pluggy-0.13.0
rootdir: /opt/app
plugins: snapshottest-0.5.1
collecting ... Fatal Python error: Segmentation fault

Current thread 0x00007f6e9e135740 (most recent call first):
  File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 1043 in create_module
  File "<frozen importlib._bootstrap>", line 583 in module_from_spec
  File "<frozen importlib._bootstrap>", line 670 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 967 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 983 in _find_and_load
  File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1035 in _handle_fromlist
  File "/opt/app/moshe/lib/python3.7/site-packages/lxml/html/__init__.py", line 53 in <module>
  File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 728 in exec_module
  File "<frozen importlib._bootstrap>", line 677 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 967 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 983 in _find_and_load
  File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1035 in _handle_fromlist
  File "/opt/app/moshe.py", line 1 in <module>
  File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 728 in exec_module
  File "<frozen importlib._bootstrap>", line 677 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 967 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 983 in _find_and_load
  File "/opt/app/moshe/lib/python3.7/site-packages/py/_path/local.py", line 701 in pyimport
  File "/opt/app/moshe/lib/python3.7/site-packages/_pytest/python.py", line 501 in _importtestmodule
  File "/opt/app/moshe/lib/python3.7/site-packages/_pytest/python.py", line 433 in _getobj
  File "/opt/app/moshe/lib/python3.7/site-packages/_pytest/python.py", line 256 in obj
  File "/opt/app/moshe/lib/python3.7/site-packages/_pytest/python.py", line 449 in _inject_setup_module_fixture
  File "/opt/app/moshe/lib/python3.7/site-packages/_pytest/python.py", line 436 in collect
  File "/opt/app/moshe/lib/python3.7/site-packages/_pytest/runner.py", line 256 in <lambda>
  File "/opt/app/moshe/lib/python3.7/site-packages/_pytest/runner.py", line 229 in from_call
  File "/opt/app/moshe/lib/python3.7/site-packages/_pytest/runner.py", line 256 in pytest_make_collect_report
  File "/opt/app/moshe/lib/python3.7/site-packages/pluggy/callers.py", line 187 in _multicall
  File "/opt/app/moshe/lib/python3.7/site-packages/pluggy/manager.py", line 86 in <lambda>
  File "/opt/app/moshe/lib/python3.7/site-packages/pluggy/manager.py", line 92 in _hookexec
  File "/opt/app/moshe/lib/python3.7/site-packages/pluggy/hooks.py", line 286 in __call__
  File "/opt/app/moshe/lib/python3.7/site-packages/_pytest/runner.py", line 375 in collect_one_node
  File "/opt/app/moshe/lib/python3.7/site-packages/_pytest/main.py", line 703 in genitems
  File "/opt/app/moshe/lib/python3.7/site-packages/_pytest/main.py", line 478 in _perform_collect
  File "/opt/app/moshe/lib/python3.7/site-packages/_pytest/main.py", line 439 in perform_collect
  File "/opt/app/moshe/lib/python3.7/site-packages/_pytest/main.py", line 246 in pytest_collection
  File "/opt/app/moshe/lib/python3.7/site-packages/pluggy/callers.py", line 187 in _multicall
  File "/opt/app/moshe/lib/python3.7/site-packages/pluggy/manager.py", line 86 in <lambda>
  File "/opt/app/moshe/lib/python3.7/site-packages/pluggy/manager.py", line 92 in _hookexec
  File "/opt/app/moshe/lib/python3.7/site-packages/pluggy/hooks.py", line 286 in __call__
  File "/opt/app/moshe/lib/python3.7/site-packages/_pytest/main.py", line 236 in _main
  File "/opt/app/moshe/lib/python3.7/site-packages/_pytest/main.py", line 193 in wrap_session
  File "/opt/app/moshe/lib/python3.7/site-packages/_pytest/main.py", line 230 in pytest_cmdline_main
  File "/opt/app/moshe/lib/python3.7/site-packages/pluggy/callers.py", line 187 in _multicall
  File "/opt/app/moshe/lib/python3.7/site-packages/pluggy/manager.py", line 86 in <lambda>
  File "/opt/app/moshe/lib/python3.7/site-packages/pluggy/manager.py", line 92 in _hookexec
  File "/opt/app/moshe/lib/python3.7/site-packages/pluggy/hooks.py", line 286 in __call__
  File "/opt/app/moshe/lib/python3.7/site-packages/_pytest/config/__init__.py", line 90 in main
  File "/opt/app/moshe/bin/pytest", line 8 in <module>
Segmentation fault
@AvnerCohen AvnerCohen changed the title Crash on pytest Crash on pytest - segmentation fault Oct 28, 2019
@AvnerCohen
Copy link
Author

@sabard
Copy link

sabard commented Mar 29, 2020

I am having this same issue using OpenCV. The seg fault happens on import cv2 after calling pytest. Downgrading to snapshottest 0.5.0 fixes the issue for me.

@sabard
Copy link

sabard commented Mar 29, 2020

Here is an example of the bug: https://github.com/sabard/snapshottest-cv2-bug

@sabard
Copy link

sabard commented Mar 30, 2020

BTW—this only happens on Python 3.7, not 3.8. Unfortunately, we need to use 3.7 for the version of OpenCV we're using.

@noahnu
Copy link

noahnu commented Apr 10, 2020

From another issue, I think there's a fork of snapshottest which is a bit more up to date. As an alternative, I've been working on my own snapshot library (pytest only) which has addressed all the open issues in this repo. It's also actively developed, if you want to give it a try. We're very much open to community feedback (and contributions): https://github.com/tophat/syrupy.

Migration has been kept simple, no need to change call sites (unless you want to use our more pytest friendly syntax).

@paulmelnikow
Copy link
Collaborator

I imagine this must be an upstream issue. Based on reading pytest-dev/pytest#3672, it sounds like it is also not an issue with pytest. Python 3.7 is still being supported, so I'd suggest trying to continue the work done in that issue to isolate the problem, and reporting it upstream with Python itself.

@paulmelnikow paulmelnikow changed the title Crash on pytest - segmentation fault Segmentation fault in Python 3.7 Sep 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants