01-23-04 10:35 PM
Hi all,
RHL7.2, glibc2.2.4, pthread.
Same dlsym() went well until segfault with stack trace below today:
#0 _dl_lookup_symbol (undef_name=0x8068e98 "callsub", undef_map=0x40016c00,
ref=0x42b6fef4, symbol_scope=0x814e2bc, type_class=0, explicit=1) at
do-lookup.h:80
#1 0x40c50e70 in _dl_sym (handle=0x1c80, name=0x8068e98 "callsub",
who=0x0)at dl-sym.c:62
#2 0x40acc450 in dlsym_doit (a=0x42b7003c) at dlsym.c:39
#3 0x4000d7c3 in _dl_catch_error (objname=0x837dda8,
errstring=0x837ddac,operate=0x40acc430 <dlsym_doit>, args=0x42b7003c) at
dl-error.c:152
#4 0x40acc6fb in _dlerror_run (operate=0x40acc430
<dlsym_doit>,args=0x42b7003c) at dlerror.c:130
#5 0x40acc416 in dlsym (handle=0x814e108, name=0x8068e98 "callsub") at
dlsym.c:51
#6 0x08065378 in myclass::calllib (this=0x83938d8, bufout=0x42b7ef9c) at
mychildthread.cpp:87
The code snippet as thus:
// mychildthread.cpp
...
plib = dlopen("mylib", RTLD_LAZY);
if (!plib) {
error = dlerror();
deb_dump(...);
return ERR_LIB;
}
dlerror();
callsub = ( func_callsub )dlsym(plib, "callsub"); // line 87
if ((error = dlerror())) {...}
...
App's main thread dlopen() "mylib" and dlclose() it only when it exits.
Should each (child)thread uses a mutex for dlopen()/dlsym()/dlclose() for
above issue? my app doesn't. If not, what is the possible reason?
Thanks in advance
-sean
[ Post a follow-up to this message ]
|