本文介绍了_dl_close断言失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用dlopen(),我写,这样我可以有一个插件系统为我的模块一个Apache模块中。我发现,如果我编译我的模块,编译我的插件,并启动Apache,一切工作桃色,激烈。

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.

如果,但是,我已经做了一切之后,我重新编译我的插件,(使一个小的变化或两个插件code,)我的下一个页面加载也可以让Apache段错误。每个后续请求的作品就好,一次。因此,仅在第一页负载立即编译导致该段错误之后

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.

我一直在试图解决这一几天(我不是位于C调试巨大的),今天,我在Apache的错误日志中注意到了这一点:

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!

任何人有任何想法是怎么回事?这是否意味着这不是我的code和我一直在追捕一个幻象的错误?我相当有信心,我叫dlcose()每次调用dlopen的()。然而,这种特定的错误/段错误,似乎当我运行在单进程模式Apache和快速开始刷新页面的情况发生。

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.

推荐答案

一些想法:


  1. 也许你叫的dlopen()更多然后一次? DL 库维护它在每一个的dlopen()所以 dlclose()增加引用计数将卸载库只如果计数器== 0。

  1. Probably you call dlopen() more then once? dl library maintains reference counters which is incremented on every dlopen() so dlclose() will unload the library ONLY if counter == 0.

你指定 RTLD_NODELETE 的dlopen标志()(假设你是在Linux上)?如果是, dlclose()不会卸载您的图书馆。

Did you specify RTLD_NODELETE flag for dlopen() (assuming you are on Linux)? If yes, dlclose() won't unload your library.

你有没有尝试调试系统调用与 strace的?启动Apache,认定其PID和跟踪所有系统调用的Apache没有按调用使用strace -p< PID> 。也许它会给你一些想法是怎么回事。

Did you try to debug syscalls with strace? Start Apache, finds its pid and trace all syscalls Apache doesn by calling strace -p<pid>. Probably it will give you some idea what is going on.

这篇关于_dl_close断言失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-31 04:39