You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by Paul Colby <pa...@colby.id.au> on 2011/07/16 16:25:35 UTC

segfault in __cxa_finalize when unloading libqpidmessaging

Hi guys,

I'm totally stumped with this one (and more than just a little out of my
depth).

I've been looking into a strange segfault that happens with the new
swig-based PHP binding when the PHP command line interpreter loads and then
unloads the cqpid_php module quickly.

You can see more details in the last few comments at
https://issues.apache.org/jira/browse/QPID-3027

But in short, when the cqpid.so library (the swig-based PHP binding) is
unloaded by PHP, we get a segfault with backtrace like this:

Program received signal SIGSEGV, Segmentation fault.
0x00000000 in ?? ()
(gdb) bt
#0 0x00000000 in ?? ()
#1 0xb7980688 in __cxa_finalize () from /lib/i686/cmov/libc.so.6
#2 0xb7369df4 in __do_global_dtors_aux () from /lib/libqpidmessaging.so.2
#3 0xb73c1ba0 in _fini () from /lib/libqpidmessaging.so.2
#4 0xb7ff571e in ?? () from /lib/ld-linux.so.2
#5 0xb7ff6197 in ?? () from /lib/ld-linux.so.2
#6 0xb7ce0ca4 in ?? () from /lib/i686/cmov/libdl.so.2
#7 0xb7ff07f6 in ?? () from /lib/ld-linux.so.2
#8 0xb7ce109c in ?? () from /lib/i686/cmov/libdl.so.2
#9 0xb7ce0cda in dlclose () from /lib/i686/cmov/libdl.so.2
#10 0x083dcf54 in module_destructor (module=0x8913198) at
/home/david/php5-5.3.3/Zend/zend_API.c:2120

This looks to me like it might be related to
http://web.archiveorange.com/archive/v/7nip7tkWhQpEnlSqODIz ?  But I'm not
sure.

I've tried a whole lot of little things, but nothing seems to make any
difference.  And since this __cxa_finalize function is something gcc
generates internally, it's quite beyond my level of knowledge!

As noted on the above QPID-3027 issue, this does not seem to be a problem is
libqpidmessaging.so etc is built via cmake instead of gnu autotools, but
that might just be a co-incidence.

Also, internally PHP calls dlopen with the RTLD_LAZY flag... if I modify PHP
to use RTLD_NOW instead, that seems to fix the problem, but that should not
be necessary AFAIK (nor would it be practical).

So, any hints / tips / suggestions on where to go, or what to try next?  Is
there someone here with really deep gcc / compiler knowledge that could help
me look into this?  or should I be heading to some gcc-specific discussion
group somewhere else?

Thanks!

paul.
----
http://colby.id.au