Page 1 of 1

multithread seg fault

Posted: 2012-04-09T14:19:19-07:00
by blowzy
Seams that IM++ on my multithread application crash with Segmentation failt at this simple code:

Code: Select all

			
Magick::Image::Image img;
img.read( picturepath );
IM:
> convert -version
Version: ImageMagick 6.7.5-10 2012-04-03 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Features:
disabled: threads and openmp (when compiled)
enabled: 16bit-pixel, bzlib, fftw, fpx, jbig, jpeg, jpeg2000, lcms2, lcms, lzma, lqr, perl, png, tiff, ttf, webp

System:
> uname -a
FreeBSD A0201 7.3-RELEASE-p2 FreeBSD 7.3-RELEASE-p2


Maybe any suggestion how to fix this? Maybe need to init some settings or variables for IM if I use it in multithread mode?
thanks

PS. On other FreeBSD version 8.2 and IM
#convert -version
Version: ImageMagick 6.7.3-4 2012-01-01 Q16
This code work well!

Re: multithread seg fault

Posted: 2012-04-09T14:36:40-07:00
by blowzy
YOUR TEST

I run your thread unit tests from this my thread on the problem system (as I wrote above): viewtopic.php?f=23&t=20090

And result is:
> > ./imtest
Invalid null command.
Size: 500x332 / JPEG Blob-Length: 33087
Size: 170x134
Size: 188x138
Size: 188x138
Size: 188x126
Size: 178x124
Size: 174x132
Size: 188x134
Size: 170x138
Size: 174x130
Segmentation fault (core dumped)

Re: multithread seg fault

Posted: 2012-04-09T16:41:20-07:00
by magick
Can you get a stack trace? An alternative would be a minimal set of code and instructions so we can reproduce the fault.

Re: multithread seg fault

Posted: 2012-04-10T01:04:05-07:00
by blowzy
Stack:
(gdb) fr 1
#1 0x4827524f in SignatureImage () from /usr/local/lib/libMagickCore.so.5
whole stack
#0 0x482752ba in SignatureImage () from /usr/local/lib/libMagickCore.so.5
#1 0x4827524f in SignatureImage () from /usr/local/lib/libMagickCore.so.5
#2 0x4827524f in SignatureImage () from /usr/local/lib/libMagickCore.so.5
#3 0x4827524f in SignatureImage () from /usr/local/lib/libMagickCore.so.5
#4 0x4827524f in SignatureImage () from /usr/local/lib/libMagickCore.so.5
#5 0x4827524f in SignatureImage () from /usr/local/lib/libMagickCore.so.5
#6 0x4827524f in SignatureImage () from /usr/local/lib/libMagickCore.so.5
#7 0x4827524f in SignatureImage () from /usr/local/lib/libMagickCore.so.5
#8 0x4827524f in SignatureImage () from /usr/local/lib/libMagickCore.so.5
#9 0x4827524f in SignatureImage () from /usr/local/lib/libMagickCore.so.5
#10 0x4827524f in SignatureImage () from /usr/local/lib/libMagickCore.so.5
#11 0x4827524f in SignatureImage () from /usr/local/lib/libMagickCore.so.5
#12 0x4827524f in SignatureImage () from /usr/local/lib/libMagickCore.so.5
#13 0x4827524f in SignatureImage () from /usr/local/lib/libMagickCore.so.5
#14 0x4827524f in SignatureImage () from /usr/local/lib/libMagickCore.so.5
#15 0x4827524f in SignatureImage () from /usr/local/lib/libMagickCore.so.5
#16 0x4827524f in SignatureImage () from /usr/local/lib/libMagickCore.so.5
#17 0x4827524f in SignatureImage () from /usr/local/lib/libMagickCore.so.5
#18 0x4827524f in SignatureImage () from /usr/local/lib/libMagickCore.so.5
#19 0x4827524f in SignatureImage () from /usr/local/lib/libMagickCore.so.5
#20 0x4827524f in SignatureImage () from /usr/local/lib/libMagickCore.so.5
#21 0x4827524f in SignatureImage () from /usr/local/lib/libMagickCore.so.5
#22 0x482757cd in ResetSplayTree () from /usr/local/lib/libMagickCore.so.5
---Type <return> to continue, or q <return> to quit---
#23 0x48276140 in GetNextValueInSplayTree ()
from /usr/local/lib/libMagickCore.so.5
#24 0x481fc699 in GetMagickInfo () from /usr/local/lib/libMagickCore.so.5
#25 0x481e9948 in SetImageInfo () from /usr/local/lib/libMagickCore.so.5
#26 0x48141898 in ImageToBlob () from /usr/local/lib/libMagickCore.so.5
#27 0x480d7b06 in Magick::Image::write () from /usr/local/lib/libMagick++.so.5
#28 0x08049690 in testthread ()
#29 0x486b07cc in pthread_getprio () from /lib/libthr.so.3
#30 0x00000000 in ?? ()
I have also tried to change the original test code and see that often its crashed when many threads work with "write" function.
when on the original test code 30, 31 lines are commented - its crashed less times, but can "hang".
Crashed always at SignatureImage ();

Maybe will try to install older IM version...
added: current version recompiled - does not help

Re: multithread seg fault

Posted: 2012-04-14T13:48:48-07:00
by blowzy
any ideas?