I am using dlopen() within an Apache module that i'm writing to ensure that I may have a wordpress plugin system for my module. I have discovered that basically compile my module, compile my wordpress plugin, and begin Apache, everything works peachy-keen.

If, however, once i did everything, I recompile my wordpress plugin, (creating a small change or two towards the plug ins code,) my next page load may cause Apache to segfault. Each subsequent request works all right, again. Thus, it is simply page one load soon after producing that triggers the segfault.

I have been attempting to tackle this for any couple of days (I am not efficient at C debugging) now, I observed this during my apache error logs:

Inconsistency detected by ld.so: dl-close.c: 719: _dl_close: Assertion `map->l_init_called' failed!

Anybody have idea what's happening? Performs this mean it isn't my code which I have been hunting a phantom bug? I'm fairly certain that I call dlcose() for every call to dlopen(). However, this specific bug/segfault appears to occur after i run apache in single-process mode and begin refreshing the page rapidly.


  1. Most likely you call dlopen() more then once? dl library keeps reference counters that is incremented on every dlopen() so dlclose() will unload the library Only when counter == .

  2. Have you specify RTLD_NODELETE flag for dlopen() (presuming you are well on Linux)? If so, dlclose() will not unload your library.

Have you attempt to debug syscalls with strace? Start Apache, finds its pid and trace all syscalls Apache doesn by calling strace -p<pid>. Most likely you'll have an idea what's going on.