Page 1 of 1

What do I lose by disabling threads?

Posted: 2007-09-26T07:41:35-07:00
by mi
Hello!

What's the penalty for `--disable-threads'? After upgrading the FreeBSD port of ImageMagick, I received a bug-report from a user, who was unable to use PerlMagick, because their perl was built without threads.

I'm thinking about simply adding `--disable-threads' to CONFIGURE_ARGS -- this seems to work with both threaded and non-threaded perl.

What is the penalty?

Could `configure', when it analyzes the available perl installation, also determine, whether threads are supported?..

Thanks!

Re: What do I lose by disabling threads?

Posted: 2007-09-26T07:52:13-07:00
by magick
ImageMagick works fine without threads. However, a number of the ImageMagick language wrappers defined here: http://www.imagemagick.org/script/api.php assume a threaded environment and their applications will crash and burn when they call ImageMagick methods from more than one thread of execution. With threads enabled, ImageMagick applies numerous mutex locks to serialize the splay-tree, hash, list methods, generating Wand ids, etc.

It may be possible the get PerlMagick to build even if ImageMagick is threaded. We will need to investigate further.

We could enhance the configure script to automatically disable threads if Perl is not threaded. We will need to investigate further.

Re: What do I lose by disabling threads?

Posted: 2007-09-26T10:04:16-07:00
by mi
magick wrote:We could enhance the configure script to automatically disable threads if Perl is not threaded. We will need to investigate further.
Please, do. Users are reporting the following problems:

Code: Select all

t/bzlib/write.....Can't load 
'/usr/ports/graphics/ImageMagick/work/ImageMagick-6.3.5/PerlMagick/blib/arch/auto/Image/Magick/Magick.so' 
for module Image::Magick: /usr/local/lib/libIlmThread.so.4: Undefined 
symbol "pthread_join" at /usr/local/lib/perl5/5.8.8/mach/DynaLoader.pm 
line 230.
  at t/bzlib/write.t line 10
Compilation failed in require at t/bzlib/write.t line 10.
BEGIN failed--compilation aborted at t/bzlib/write.t line 10.
Deep recursion on subroutine "Image::Magick::AUTOLOAD" at 
/usr/ports/graphics/ImageMagick/work/ImageMagick-6.3.5/PerlMagick/blib/lib/Image/Magick.pm 
line 42.
Out of memory during request for 112 bytes, total sbrk() is 536811520 bytes!
t/bzlib/write.....dubious
         Test returned status 0 (wstat 139, 0x8b)
DIED. FAILED test 1
         Failed 1/1 tests, 0.00% okay
The initial problem of not being able to load the Magick.so (due to missing symbol) is compounded by perl consumming all available memory -- a reaction, apparently, unique to PerlMagick.

The source of the problem in the above message is OpenEXR's libIlmThread.so.4. Using EXR requires threading, I suppose...