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 when running test_common.py::test_estimators[NuSVC()-check_classifiers_train(readonly_memmap=True)]

See original GitHub issue

Describe the bug

I followed the contributing code guidelines and ran into a segmentation fault when running the test sklearn/tests/test_common.py. It appears to come from libsvm.fit(...).

I am not sure whether it is a problem related to my device or not.

Steps/Code to Reproduce

git clone https://github.com/scikit-learn/scikit-learn.git
cd scikit-learn
python3 -m venv venv
source venv/bin/activate
pip install pip --upgrade
pip install numpy scipy matplotlib pytest sphinx cython ipykernel
pip install --no-build-isolation --editable .
pytest sklearn/tests/test_common.py

Expected Results

No error is thrown.

Actual Results

Fatal Python error: Segmentation fault

Current thread 0x00007fe406b46280 (most recent call first):
  File "/home/aperez/dev/sandbox/scikit-learn/sklearn/svm/_base.py", line 315 in _dense_fit
  File "/home/aperez/dev/sandbox/scikit-learn/sklearn/svm/_base.py", line 255 in fit
  File "/home/aperez/dev/sandbox/scikit-learn/sklearn/utils/estimator_checks.py", line 2091 in check_classifiers_train
  File "/home/aperez/dev/sandbox/scikit-learn/sklearn/utils/_testing.py", line 313 in wrapper
  File "/home/aperez/dev/sandbox/scikit-learn/sklearn/tests/test_common.py", line 109 in test_estimators
  File "/home/aperez/dev/sandbox/scikit-learn/venv/lib/python3.8/site-packages/_pytest/python.py", line 183 in pytest_pyfunc_call
  File "/home/aperez/dev/sandbox/scikit-learn/venv/lib/python3.8/site-packages/pluggy/_callers.py", line 39 in _multicall
  File "/home/aperez/dev/sandbox/scikit-learn/venv/lib/python3.8/site-packages/pluggy/_manager.py", line 80 in _hookexec
  File "/home/aperez/dev/sandbox/scikit-learn/venv/lib/python3.8/site-packages/pluggy/_hooks.py", line 265 in __call__
  File "/home/aperez/dev/sandbox/scikit-learn/venv/lib/python3.8/site-packages/_pytest/python.py", line 1641 in runtest
  File "/home/aperez/dev/sandbox/scikit-learn/venv/lib/python3.8/site-packages/_pytest/runner.py", line 162 in pytest_runtest_call
  File "/home/aperez/dev/sandbox/scikit-learn/venv/lib/python3.8/site-packages/pluggy/_callers.py", line 39 in _multicall
  File "/home/aperez/dev/sandbox/scikit-learn/venv/lib/python3.8/site-packages/pluggy/_manager.py", line 80 in _hookexec
  File "/home/aperez/dev/sandbox/scikit-learn/venv/lib/python3.8/site-packages/pluggy/_hooks.py", line 265 in __call__
  File "/home/aperez/dev/sandbox/scikit-learn/venv/lib/python3.8/site-packages/_pytest/runner.py", line 255 in <lambda>
  File "/home/aperez/dev/sandbox/scikit-learn/venv/lib/python3.8/site-packages/_pytest/runner.py", line 311 in from_call
  File "/home/aperez/dev/sandbox/scikit-learn/venv/lib/python3.8/site-packages/_pytest/runner.py", line 254 in call_runtest_hook
  File "/home/aperez/dev/sandbox/scikit-learn/venv/lib/python3.8/site-packages/_pytest/runner.py", line 215 in call_and_report
  File "/home/aperez/dev/sandbox/scikit-learn/venv/lib/python3.8/site-packages/_pytest/runner.py", line 126 in runtestprotocol
  File "/home/aperez/dev/sandbox/scikit-learn/venv/lib/python3.8/site-packages/_pytest/runner.py", line 109 in pytest_runtest_protocol
  File "/home/aperez/dev/sandbox/scikit-learn/venv/lib/python3.8/site-packages/pluggy/_callers.py", line 39 in _multicall
  File "/home/aperez/dev/sandbox/scikit-learn/venv/lib/python3.8/site-packages/pluggy/_manager.py", line 80 in _hookexec
  File "/home/aperez/dev/sandbox/scikit-learn/venv/lib/python3.8/site-packages/pluggy/_hooks.py", line 265 in __call__
  File "/home/aperez/dev/sandbox/scikit-learn/venv/lib/python3.8/site-packages/_pytest/main.py", line 348 in pytest_runtestloop
  File "/home/aperez/dev/sandbox/scikit-learn/venv/lib/python3.8/site-packages/pluggy/_callers.py", line 39 in _multicall
  File "/home/aperez/dev/sandbox/scikit-learn/venv/lib/python3.8/site-packages/pluggy/_manager.py", line 80 in _hookexec
  File "/home/aperez/dev/sandbox/scikit-learn/venv/lib/python3.8/site-packages/pluggy/_hooks.py", line 265 in __call__
  File "/home/aperez/dev/sandbox/scikit-learn/venv/lib/python3.8/site-packages/_pytest/main.py", line 323 in _main
  File "/home/aperez/dev/sandbox/scikit-learn/venv/lib/python3.8/site-packages/_pytest/main.py", line 269 in wrap_session
  File "/home/aperez/dev/sandbox/scikit-learn/venv/lib/python3.8/site-packages/_pytest/main.py", line 316 in pytest_cmdline_main
  File "/home/aperez/dev/sandbox/scikit-learn/venv/lib/python3.8/site-packages/pluggy/_callers.py", line 39 in _multicall
  File "/home/aperez/dev/sandbox/scikit-learn/venv/lib/python3.8/site-packages/pluggy/_manager.py", line 80 in _hookexec
  File "/home/aperez/dev/sandbox/scikit-learn/venv/lib/python3.8/site-packages/pluggy/_hooks.py", line 265 in __call__
  File "/home/aperez/dev/sandbox/scikit-learn/venv/lib/python3.8/site-packages/_pytest/config/__init__.py", line 162 in main
  File "/home/aperez/dev/sandbox/scikit-learn/venv/lib/python3.8/site-packages/_pytest/config/__init__.py", line 185 in console_main
  File "/home/aperez/dev/sandbox/scikit-learn/venv/bin/pytest", line 8 in <module>
Erreur de segmentation (core dumped)

Versions

System:
    python: 3.8.10 (default, May 27 2021, 17:54:13)  [GCC 9.3.0]
executable: /home/aperez/dev/sandbox/scikit-learn/venv/bin/python
   machine: Linux-5.13.0-1014-oem-x86_64-with-glibc2.29

Python dependencies:
          pip: 21.3
   setuptools: 56.0.0
      sklearn: 1.1.dev0
        numpy: 1.21.2
        scipy: 1.7.1
       Cython: 0.29.24
       pandas: None
   matplotlib: 3.4.3
       joblib: 1.1.0
threadpoolctl: 3.0.0

Built with OpenMP: True

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:23 (23 by maintainers)

github_iconTop GitHub Comments

1reaction
aperezlebelcommented, Nov 16, 2021

I do confirm that I don’t get the segfault anymore with scipy 1.7.2 whereas I get it with scipy 1.7.1.

1reaction
ogriselcommented, Oct 19, 2021

It’s possible that openblas 0.3.9 on CPU architectures detected as Prescott has a bug with readonly memory buffer that causes the segfault.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Identify what's causing segmentation faults (segfaults)
A segmentation fault (aka segfault) is a common condition that causes programs to crash; they are often associated with a file named core...
Read more >
Segmentation fault after program runs correctly - Stack Overflow
You got a segfault because the char *str was never allocated with some memory. You need to initialize it in the right way:...
Read more >
Segmentation Fault when running commands
Some commands we type we are getting "segmentaion fault" in the console screen as a return. successful commands: Raw. cat, mount, df -h,...
Read more >
Segmentation fault when run demo and some fix #9 - GitHub
demo command, and it run failed. Without and error message. ... Then I can run without error(sometimes). And I found the following change...
Read more >
Tips on Segmentation Faults
A common run-time error for C programs by beginners is a "segmentation violation" or "segmentation fault." When you run your program and the ......
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