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 error #58

Closed
anis-campos opened this issue Apr 22, 2020 · 0 comments · Fixed by #59
Closed

Segmentation fault error #58

anis-campos opened this issue Apr 22, 2020 · 0 comments · Fixed by #59

Comments

@anis-campos
Copy link
Contributor

anis-campos commented Apr 22, 2020

Env

OS: MacOS Catalina 10.15.4 (19E287)
Python: Python 3.7.7 ( using asdf )

Issue

Nominal case

After creating a venv, runnin dep_check shows help preceded by a error message like the following:

(venv) ➜  dep_check  

# pkg-config --cflags  -- python3
Package python3 was not found in the pkg-config search path.
Perhaps you should add the directory containing `python3.pc'
to the PKG_CONFIG_PATH environment variable
No package 'python3' found
pkg-config: exit status 1
WARNING:root:Couldn't load GO library, you won't be able to use dep-check on GO projects.
usage: dep_check [-h] {build,check,graph}
dep_check: error: the following arguments are required: feature
(venv) ➜  

Segfault

I tried to remove the warning by adding to the the following to my profile file

#setup for pkg-config
export PKG_CONFIG_PATH=$(asdf where python 3.7.7)/lib/pkgconfig/

This solves the warning issue but the resulting goparse.so from the go build is faulty creating a segmentation fault:

(venv) ➜  test python -Xfaulthandler venv/bin/dep_check 

Fatal Python error: Segmentation fault

Current thread 0x0000000112af9dc0 (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 "/private/tmp/test/venv/lib/python3.7/site-packages/dep_check/infra/go_parser.py", line 9 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 "/private/tmp/test/venv/lib/python3.7/site-packages/dep_check/main.py", line 13 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 "venv/bin/dep_check", line 6 in <module>
[1]    93970 segmentation fault  python -Xfaulthandler venv/bin/dep_check

I'm not sure why there is a segmentation fault, might be related to my environment. But in any case, the project is python only so this seg fault should no happen

Proposed solution:

There 2 solution for this issue from what I could investigate.

1 - No error message:

Do no show the pkg-config error message if possible. This would prevent people like me to try solving it as it is pretty explicit and easy to follow

2 - Only import GoParser if necessary

The seg fault is caused by the

#infra/go_parser.py 
9: from .lib import goparse

I don't the reason why there is a seg fault, but it's most likely a library linking issue, but in a python project this should not matter !

So instead of importing the go module in every case, import it on demand if the project uses go.

@anis-campos anis-campos mentioned this issue Jun 29, 2020
@tvuillemin tvuillemin linked a pull request Jun 30, 2020 that will close this issue
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 a pull request may close this issue.

1 participant