[asterisk-commits] mjordan: trunk r402290 - in /trunk: ./ main/loader.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Oct 31 11:06:16 CDT 2013
Author: mjordan
Date: Thu Oct 31 11:06:14 2013
New Revision: 402290
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=402290
Log:
core/loader: Don't call dlclose in a while loop
For awhile now, we've noticed continuous integration builds hanging on CentOS 6
64-bit build agents. After resolving a number of problems with symbols, strange
locks, and other shenanigans, the problem has persisted. In all cases, gdb
shows the Asterisk process stuck in loader.c on one of the infinite while loops
that calls dlclose repeatedly until success.
The documentation of dlclose states that it returns 0 on success; any other
value on error. It does not state that repeatedly calling it will eventually
clear those errors. Most likely, the repeated calls to dlclose was to force a
close by exhausting the references on the library; however, that will never
succeed if:
(a) There is some fundamental error at work in the loaded library that
precludes unloading it
(b) Some other loaded module is referencing a symbol in the currently loaded
module
This results in Asterisk sitting forever.
Since we have matching pairs of dlopen/dlclose, this patch opts to only call
dlclose once, and log out as an ERROR if dlclose fails to return success. If
nothing else, this might help to determine why on the CentOS 6 64-bit build agent
things are not closing successfully.
Review: https://reviewboard.asterisk.org/r/2970
........
Merged revisions 402287 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 402288 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 402289 from http://svn.asterisk.org/svn/asterisk/branches/12
Modified:
trunk/ (props changed)
trunk/main/loader.c
Propchange: trunk/
------------------------------------------------------------------------------
--- branch-12-merged (original)
+++ branch-12-merged Thu Oct 31 11:06:14 2013
@@ -1,1 +1,1 @@
-/branches/12:1-398558,398560-398577,398579-399305,399307-401390,401392-402276,402285
+/branches/12:1-398558,398560-398577,398579-399305,399307-401390,401392-402276,402285,402289
Modified: trunk/main/loader.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/loader.c?view=diff&rev=402290&r1=402289&r2=402290
==============================================================================
--- trunk/main/loader.c (original)
+++ trunk/main/loader.c Thu Oct 31 11:06:14 2013
@@ -412,9 +412,18 @@
*/
static void logged_dlclose(const char *name, void *lib)
{
- if (dlclose(lib) != 0) {
- ast_log(LOG_WARNING, "Failed to unload %s: %s\n",
- name, dlerror());
+ char *error;
+
+ if (!lib) {
+ return;
+ }
+
+ /* Clear any existing error */
+ dlerror();
+ if (dlclose(lib)) {
+ error = dlerror();
+ ast_log(AST_LOG_ERROR, "Failure in dlclose for module '%s': %s\n",
+ S_OR(name, "unknown"), S_OR(error, "Unknown error"));
}
}
@@ -457,12 +466,7 @@
/* WARNING: the structure pointed to by mod is going to
disappear when this operation succeeds, so we can't
dereference it */
-
- if (!lib) {
- return;
- }
-
- logged_dlclose(name, lib);
+ logged_dlclose(ast_module_name(mod), lib);
/* There are several situations where the module might still be resident
* in memory.
More information about the asterisk-commits
mailing list