[Devel] dlopen(... RTLD_LOCAL vs. RTLD_GLOBAL

Bastian Friedrich bastian.friedrich at collax.com
Wed Nov 15 18:17:30 CET 2006


Hi,

currently I'm struggling with some segfaults here and there created by dynamic 
loaders in different parts of my code.

If my perl4ser module is built and loaded as a dynamic module (as it should 
be), it is not possible to use perl modules that again load shared objects: 
in this case, openser segfaults (for unknown reasons... deep within the perl 
library). With a static module, it works fine.

If the module loading by dlopen() is modified to use RTLD_NOW | RTLD_GLOBAL as 
it's flags, this seems to work fine.

Unfortunately, t_relay() breaks, then: Any call that is processed by t_relay() 
causes a segfault :((((

In a nutshell: With RTLD_LOCAL (default behavior on linux), perl segfaults. 
With RTLD_GLOBAL, t_relay segfaults :((

So my questions are:
* Is there any particular reason why you don't set the "RTLD_GLOBAL" flag in
  sr_module.c? Besides the segfault, that is ;). Yes, I know that this flag
  probably does not exist on all supported platforms...
* Although OpenSER works well, I see a problem here; do you agree?
* Do you have any idea how to fix the problem? I'm not really deep into the
  matter of dynamic loading... :(

Thx in advance!

Frustrated,
   Bastian

-- 
Collax GmbH . Burkheimer Straße 3 . 79111 Freiburg . Germany
p: +49 (0) 761-45684-24
f: +49 (0) 761-45684-10        www.collax.com

\ Sleep is a poor substitute for caffeine.



More information about the Devel mailing list