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

Seg fault when loading image file - v0.6.9 #587

Closed
wfm opened this issue Aug 10, 2022 · 7 comments
Closed

Seg fault when loading image file - v0.6.9 #587

wfm opened this issue Aug 10, 2022 · 7 comments
Assignees
Labels

Comments

@wfm
Copy link

wfm commented Aug 10, 2022

I'm having trouble with Wand 0.6.9 on my M1 MacBook Pro:

Python 3.9.13 (main, Aug  7 2022, 01:19:39) 
[Clang 13.1.6 (clang-1316.0.21.2.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from wand.image import Image
>>> img = Image(file="~/Downloads/Signature.png")
[1]    22837 segmentation fault  python

Here is the top of the stack trace:

Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   libomp.dylib                  	       0x10356f63c __kmp_set_indirect_lock(unsigned int*, int) + 12
1   libomp.dylib                  	       0x103537a54 __kmpc_set_lock + 220
2   libMagickCore-7.Q16HDRI.10.dylib	       0x1037fca20 ActivateSemaphoreInfo + 52
3   libMagickWand-7.Q16HDRI.10.dylib	       0x1034ce540 AcquireWandId + 40
4   libMagickWand-7.Q16HDRI.10.dylib	       0x10348181c NewMagickWand + 64
5   libffi.dylib                  	       0x190030050 ffi_call_SYSV + 80
6   libffi.dylib                  	       0x190038ae8 ffi_call_int + 1208
7   _ctypes.cpython-39-darwin.so  	       0x102d78ea8 _ctypes_callproc + 872
8   _ctypes.cpython-39-darwin.so  	       0x102d7391c PyCFuncPtr_call + 220
9   Python                        	       0x102dfb314 _PyObject_MakeTpCall + 132

I'm using ImageMagick 7.1.0-45.
I've attached the full macOS analytics report.
Thanks!
Python-2022-08-10-124705.txt

@loveJesus
Copy link

Aleluya, can confirm this happens on my Mac m1 as well with the 0.6.x line. Thanks for your work on this! Also thankfully 0.5.9 is working without crashing.

@emcconville
Copy link
Owner

Thanks for reporting this! This might be related to a recent change with ImageMagick (previously reported), or it's something else.

Can anyone with an M1 test the following with the latest from Homebrew?

Allocation with context manager

from wand.image import Image

with Image(filename="rose:") as img:
    print(img)

Genesis before allocation

from wand.image import Image
from wand.resource import genesis as wand_genesis

wand_genesis()
img = Image(filename="rose:")
print(img)

@emcconville emcconville self-assigned this Aug 10, 2022
@loveJesus
Copy link

Aleluya
First one:

[1]    73679 segmentation fault  python3

Second

<wand.image.Image: fb6fc68 'PNM' (70x46)>

thanks!

@emcconville
Copy link
Owner

Created merge request #588. If folks are able, please post evidence that the change worked.

@loveJesus
Copy link

✝hanks! Seems to work placing git+https://github.com/emcconville/wand.git@issue_587#egg=wand in requirements

@wfm
Copy link
Author

wfm commented Aug 11, 2022

I tried it again using the package from commit 587, with better results:

✗ python -m pip install git+https://github.com/emcconville/wand.git@issue_587#egg=wand
Collecting wand
  Cloning https://github.com/emcconville/wand.git (to revision issue_587) to /private/var/folders/l5/f7yrxhn16nl4jnfsdc9_jspm0000gn/T/pip-install-pto3yk_l/wand_8bd1f9ec6e724d5b8669307908bf720a
  Running command git clone --filter=blob:none --quiet https://github.com/emcconville/wand.git /private/var/folders/l5/f7yrxhn16nl4jnfsdc9_jspm0000gn/T/pip-install-pto3yk_l/wand_8bd1f9ec6e724d5b8669307908bf720a
  Running command git checkout -b issue_587 --track origin/issue_587
  Switched to a new branch 'issue_587'
  branch 'issue_587' set up to track 'origin/issue_587'.
  Resolved https://github.com/emcconville/wand.git to commit e5e6c0b83648d34a4c6725cebcb0b9367af66ca3
  Running command git submodule update --init --recursive -q
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: wand
  Building wheel for wand (setup.py) ... done
  Created wheel for wand: filename=Wand-0.6.9-py3-none-any.whl size=142819 sha256=2eb748e25f7a81abb81d51c8e7aa1e009fc9f43476be1c78052ca12fa5e98059
  Stored in directory: /private/var/folders/l5/f7yrxhn16nl4jnfsdc9_jspm0000gn/T/pip-ephem-wheel-cache-wv2e6mu0/wheels/92/3a/1c/b5ede17c3f5f17b2217b7766dd3870a823b2d8293b0f555f47
Successfully built wand
Installing collected packages: wand
  Attempting uninstall: wand
    Found existing installation: Wand 0.6.7
    Uninstalling Wand-0.6.7:
      Successfully uninstalled Wand-0.6.7
Successfully installed wand-0.6.9
✗ python
Python 3.9.13 (main, Aug  7 2022, 01:19:39) 
[Clang 13.1.6 (clang-1316.0.21.2.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from wand.image import Image
>>> with Image(filename="rose:") as img:
...     print(img)
... 
<wand.image.Image: fb6fc68 'PNM' (70x46)>
>>> 

I noticed that I had version 0.6.7 installed. I reported that I was using 0.6.9. I had installed 0.6.9 from the command line but forgot to source the venv activate file first (d'oh). Fortunately, the issue wasn't dependent on that.

Thank you, Eric and Brian, for your prompt attention to the issue.

@emcconville
Copy link
Owner

Wand 0.6.10 has been released to address this issue. Took a couple extra days to get the test matrix stable, but everything seems stable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants