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 when importing local module that imports numba #6717

Closed
QuantuMope opened this issue Feb 12, 2021 · 11 comments
Closed

segmentation fault when importing local module that imports numba #6717

QuantuMope opened this issue Feb 12, 2021 · 11 comments

Comments

@QuantuMope
Copy link

I keep getting segfaults when importing a local module that contains numba into a file that has symengine imported into it.
The segfaults are resolved whenever I remove either one of the imports. Anyone know why this is happening?

I'm using numba 0.53.0 and python 3.8.5 on ubuntu 20.04.
I've also been able to reproduce this on numba 0.52.0 and python 3.6.9 on ubuntu 16.04.

To reproduce, create two files as follow
main.py

import symengine as se
from utils import *

utils.py

from numba import njit

Then

PYTHONFAULTHANDLER=1 python3 main.py

produces the following:

Fatal Python error: Segmentation fault

Current thread 0x00007fc6fc9e2740 (most recent call first):
  File "/usr/lib/python3.8/ctypes/__init__.py", line 373 in __init__
  File "/home/asjchoi/.local/lib/python3.8/site-packages/llvmlite/binding/ffi.py", line 185 in <module>
  File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 783 in exec_module
  File "<frozen importlib._bootstrap>", line 671 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 975 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 991 in _find_and_load
  File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1042 in _handle_fromlist
  File "/home/asjchoi/.local/lib/python3.8/site-packages/llvmlite/binding/dylib.py", line 3 in <module>
  File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 783 in exec_module
  File "<frozen importlib._bootstrap>", line 671 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 975 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 991 in _find_and_load
  File "/home/asjchoi/.local/lib/python3.8/site-packages/llvmlite/binding/__init__.py", line 4 in <module>
  File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 783 in exec_module
  File "<frozen importlib._bootstrap>", line 671 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 975 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 991 in _find_and_load
  File "/home/asjchoi/.local/lib/python3.8/site-packages/numba/core/config.py", line 16 in <module>
  File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 783 in exec_module
  File "<frozen importlib._bootstrap>", line 671 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 975 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 991 in _find_and_load
  File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1042 in _handle_fromlist
  File "/home/asjchoi/.local/lib/python3.8/site-packages/numba/__init__.py", line 19 in <module>
  File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 783 in exec_module
  File "<frozen importlib._bootstrap>", line 671 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 975 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 991 in _find_and_load
  File "/home/asjchoi/Desktop/test/utils.py", line 1 in <module>
  File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 783 in exec_module
  File "<frozen importlib._bootstrap>", line 671 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 975 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 991 in _find_and_load
  File "main.py", line 2 in <module>
Segmentation fault (core dumped)

@gmarkall gmarkall added this to the Numba 0.53.0RC2 milestone Feb 12, 2021
@esc esc added the needtriage label Feb 12, 2021
@esc
Copy link
Member

esc commented Feb 12, 2021

I vaguely recall seeing something related to Symengine and Numba not being too compatible. I'll post here as soon as I find it again.

@gmarkall gmarkall removed this from the Numba 0.53.0RC2 milestone Feb 12, 2021
@stuartarchibald
Copy link
Contributor

Is symengine dynamically linked against another llvm compiled without symbol renaming?

@esc
Copy link
Member

esc commented Feb 12, 2021

I found it: numba/llvmlite#587

@esc
Copy link
Member

esc commented Feb 12, 2021

the stack traces appear suspiciously similar.

@isuruf
Copy link
Contributor

isuruf commented Mar 22, 2021

Should be fixed now with the latest wheels. SymEngine was statically linking to llvm, but was exporting the symbols before.

@esc
Copy link
Member

esc commented Mar 22, 2021

Should be fixed now with the latest wheels. SymEngine was statically linking to llvm, but was exporting the symbols before.

@QuantuMope can you confirm?

@QuantuMope
Copy link
Author

Problem is now fixed! Tested on symengine 0.7.0 and numba 0.53.0.

@esc
Copy link
Member

esc commented Mar 23, 2021

@QuantuMope thank you for following up and confirming that your issue has been solved.

@esc
Copy link
Member

esc commented Mar 25, 2021

@isuruf do you have a link to the symengine patch to hide the symbols?

@isuruf
Copy link
Contributor

isuruf commented Mar 25, 2021

https://github.com/symengine/symengine/blob/master/symengine/CMakeLists.txt#L253-L260 (If is for Linux and elseif is for macOS)

@esc
Copy link
Member

esc commented Mar 25, 2021

https://github.com/symengine/symengine/blob/master/symengine/CMakeLists.txt#L253-L260 (If is for Linux and elseif is for macOS)

thank you!

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

5 participants