question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Segmentation fault in Python 3.7

See original GitHub issue

Seething this crash, full report in here: https://github.com/pytest-dev/pytest/issues/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

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:4
  • Comments:6

github_iconTop GitHub Comments

1reaction
noahnucommented, 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).

0reactions
paulmelnikowcommented, Sep 29, 2020

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python 3.7.13 - Segmentation fault on import · Issue #92825
Do you see that I call PyModule_Create, this should call PyModule_Create2, but the register %RAX is zero which should be an error. It...
Read more >
Segmentation fault with urllib.request.urlopen and threads
I have tried it on Python 3.7.3 Ubuntu 18.04 Linux-4.15.0-1060-aws-x86_64-with-debian-buster-sid Python 3.7.
Read more >
Solved - Segmentation fault error after python 3.6 to 3.7 update
I have been getting this error for months now. My jails are officially broken. I have tried updating python and many other things....
Read more >
What causes a Python segmentation fault? - Stack Overflow
This happens when a python extension (written in C) tries to access a memory beyond reach. You can trace it in following ways....
Read more >
Segmentation fault caused by Pymongo in Python 3.7
Aparently at a certain point the pymongo module reads information from the database outside its memory buffers and into other python reserved ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found