I'm using dlopen() in an Apache module that I am writing so that I can have a plugin system for my module. I've found that if I compile my module, compile my plugin, and start Apache, everything works peachy-keen.
If, however, after I have done all that, I recompile my plugin, (making a small change or two to the plugins code,) my next page load will cause Apache to segfault. Each subsequent request works just fine, again. Thus, it is only the first page load immediately after compiling that causes the segfault.
I've been trying to tackle this for a few days (I'm not great at C debugging) and today, I noticed this in my apache error logs:
Inconsistency detected by ld.so: dl-close.c: 719: _dl_close: Assertion `map->l_init_called' failed!
Anyone have any idea what's going on? Does this mean it's not my code and that I've been hunting a phantom bug? I am fairly confident that I call dlcose() for each call to dlopen(). However, this particular bug/segfault seems to happen when I run apache in single-process mode and start refreshing the page quickly.