MagickGetImageBlob Issue

The MagickWand interface is a new high-level C API interface to ImageMagick core methods. We discourage the use of the core methods and encourage the use of this API instead. Post MagickWand questions, bug reports, and suggestions to this forum.
Post Reply
roxton
Posts: 2
Joined: 2011-07-28T09:25:09-07:00
Authentication code: 8675308

MagickGetImageBlob Issue

Post by roxton »

I realize that this is slightly out of scope, but I'm at a loss and would really appreciate some pointers on where to look next.

I'm getting sporadic segmentation faults calling MagickGetImageBlob on the same wand intermittently over time.

The lifecycle of the wand is basically:

1) wand = NewMagickWand()
2) MagickReadImage(wand, "/Users/roxton/image.tif")
3) MagickSetImageFormat(wand, "PNG")
4) image = MagickGetImageBlob(wand, &length)
5) MagickRelinquishMemory(image)
6) Repeat 3-5 at various intervals from different threads, never simultaneously.
7) Eventually segfault on step #4.

Here's the wrinkle. I'm doing this from Java using SWIG. The "OK, doctor, but how would you diagnose this problem if I /weren't/ obese" ethos applies, but I certainly wouldn't snub a SWIG/JNI-oriented suggestion.

The typical error message, FWIW, is:
Invalid memory access of location 0x20 rip=0x11755b550

ImageMagick 6.7.1-0 2011-07-24 Q16
roxton
Posts: 2
Joined: 2011-07-28T09:25:09-07:00
Authentication code: 8675308

Re: MagickGetImageBlob Issue

Post by roxton »

Recompiling with OpenMP disabled fixed the issue. The question is, though, is the problem due to an issue within ImageMagick or do I need to do something to make JNI play nice with a library compiled with OpenMP? I wouldn't have thought the latter would be necessary, as my JNI wrapper library doesn't use OpenMP directly.
Last edited by roxton on 2011-07-28T14:42:35-07:00, edited 1 time in total.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: MagickGetImageBlob Issue

Post by magick »

Sometimes OpenMP does not play nicely with other threading libraries. OpenMP and pthreads works properly under Linux but fails under Mac OS X for example. Perhaps that is the source of the problem you reported.
Post Reply