Skip to content
Snippets Groups Projects
  • Matthew Jordan's avatar
    e9fc3210
    core/loader: Don't call dlclose in a while loop · e9fc3210
    Matthew Jordan authored
    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
    
    
    git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@402290 65c4cc65-6c06-0410-ace0-fbb531ad65f3
    e9fc3210
    History
    core/loader: Don't call dlclose in a while loop
    Matthew Jordan authored
    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
    
    
    git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@402290 65c4cc65-6c06-0410-ace0-fbb531ad65f3