Crash on module unload, when dlclose() fails
Posted: 2007-09-15T13:05:26-07:00
Hello! I've modified our (FreeBSD's) dlclose() implementation to check for any atexit()-registered functions (or C++ destructors), which could be defined in the library being dlclose-ed.
This now causes PerlMagick to crash on exit, shortly after an attempt to dlclose EXR-module fails. The (probably smashed somewhat) stack looks like:
The exception thrown by UnregisterModule() is:
I do not yet understand, why the exception is causing corruption (perhaps, the error message is too long for some buffer?), but it crashes quite repeatedly.
Not using OpenEXR, of course, works around the problem...
This now causes PerlMagick to crash on exit, shortly after an attempt to dlclose EXR-module fails. The (probably smashed somewhat) stack looks like:
Code: Select all
#0 0x00000008095d6c60 in ?? ()
#1 0x0000000800facc15 in ClearMagickException (exception=0xc68140) at magick/exception.c:182
#2 0x0000000800facd6f in CatchException (exception=0xc68140) at magick/exception.c:231
#3 0x0000000800fe34c7 in DestroyModuleNode (module_info=0xc49480) at magick/module.c:855
#4 0x00000008010245e0 in DestroySplayTree (splay_info=0x515400) at magick/splay-tree.c:654
#5 0x0000000800fe2736 in DestroyModuleList () at magick/module.c:138
#6 0x0000000800fdedd9 in DestroyMagickList () at magick/magick.c:140
#7 0x0000000800fe0741 in MagickCoreTerminus () at magick/magick.c:1252
#8 0x0000000800dad08a in XS_Image__Magick_UNLOAD (cv=0xc57080) at Magick.xs:2149
#9 0x00000008006c01fc in Perl_pp_entersub () from /opt/lib/perl5/5.8.8/mach/CORE/libperl.so
#10 0x00000008006b8e9e in Perl_runops_standard () from /opt/lib/perl5/5.8.8/mach/CORE/libperl.so
#11 0x0000000800669cdc in Perl_call_sv () from /opt/lib/perl5/5.8.8/mach/CORE/libperl.so
#12 0x000000080066a0c7 in Perl_call_list () from /opt/lib/perl5/5.8.8/mach/CORE/libperl.so
#13 0x000000080066bc28 in perl_destruct () from /opt/lib/perl5/5.8.8/mach/CORE/libperl.so
#14 0x000000000040154e in main ()
Code: Select all
unable to close module `EXR': shared object /opt/lib/libHalf.so.4 provides a __cxa_atexit-registered function 0x803e1afd0 (static?)
Not using OpenEXR, of course, works around the problem...