Asterisk
  1. Asterisk
  2. ASTERISK-21050

Asterisk crash during startup - issues with dlclose() return code checks and module loading registration

    Details

    • Type: Bug Bug
    • Status: Closed
    • Severity: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 1.8.19.0
    • Target Release Version/s: None
    • Component/s: Core/Configuration
    • Security Level: None
    • Labels:
      None
    • Environment:
      $ uname -rsm
      NetBSD 6.0 i386
    • Frequency of Occurrence:
      Constant
    • Regression:
      Yes

      Description

      Asterisk always crahses on startup after upgrading from version 1.8.10.1 to 1.8.19.1.

      I have been able to restore its functionality through the patch here: [edit - patch link removed by mjordan]

      There are two issues:

      1- Fix incorrect dlclose() return code checks. This was reported in issue ASTERISK-15719 but is not yet fixed as far as I understand. The current code will call dlclose() more than once after it was successful, leading to undefined behavior because the passed handle is not valid anymore. My patch fixes the return value checks.

      2- For some reason I have not yet fully understood, the module loader may attempt to load a module twice. On second attempt, module is not registered a second time. The current code checks for registration by looking if the module was the last added. On the second load attempt, the current code fails to find the module as the last one in the list, considers that registration failed, and unloads the module. This causes crashes because the module is still registered as loaded from the first attempt, and its now unmapped memory regions are still referenced. My patch fixes registration check by walking the whole module list instead of checking last item.

        Issue Links

          Activity

          Hide
          Emmanuel Dreyfus added a comment -

          upload again my patch from 2013-02-08

          Show
          Emmanuel Dreyfus added a comment - upload again my patch from 2013-02-08
          Hide
          Rusty Newton added a comment - - edited

          Thanks. Can you provide instructions for a user to reproduce the crash? That'll make it easier for others to test the patch.

          Show
          Rusty Newton added a comment - - edited Thanks. Can you provide instructions for a user to reproduce the crash? That'll make it easier for others to test the patch.
          Hide
          Emmanuel Dreyfus added a comment -

          At mine it just crash on startup. I suspect it is because I do not autoload all modules. Here is my modules.conf:
          [modules]
          load => func_callerid.so
          load => app_dial.so
          load => codec_ulaw.so
          load => chan_sip.so
          load => res_realtime.so
          load => res_config_ldap.so
          load => res_rtp_asterisk.so
          load => pbx_config.so
          load => app_cdr.so
          load => cdr_csv.so
          load => func_cdr.so
          load => format_wav.so
          load => res_musiconhold.so
          load => bridge_builtin_features.so
          load => app_transfer.so
          load => app_macro.so
          load => app_voicemail.so
          load => format_gsm.so
          load => format_wav_gsm.so

          Show
          Emmanuel Dreyfus added a comment - At mine it just crash on startup. I suspect it is because I do not autoload all modules. Here is my modules.conf: [modules] load => func_callerid.so load => app_dial.so load => codec_ulaw.so load => chan_sip.so load => res_realtime.so load => res_config_ldap.so load => res_rtp_asterisk.so load => pbx_config.so load => app_cdr.so load => cdr_csv.so load => func_cdr.so load => format_wav.so load => res_musiconhold.so load => bridge_builtin_features.so load => app_transfer.so load => app_macro.so load => app_voicemail.so load => format_gsm.so load => format_wav_gsm.so
          Hide
          Rusty Newton added a comment -

          This looks like it duplicates ASTERISK-15719.

          What version of glibc are you currently using?

          I'll leave this open and link the issues since you have a patch on this that works for you and may be useful to whoever finally works the other issue.

          Show
          Rusty Newton added a comment - This looks like it duplicates ASTERISK-15719 . What version of glibc are you currently using? I'll leave this open and link the issues since you have a patch on this that works for you and may be useful to whoever finally works the other issue.
          Hide
          Matt Jordan added a comment -

          This ended up getting fixed independently in r402287 in Asterisk 1.8+. Unfortunately, when it was fixed, I didn't see your patch - a very similar approach was taken, although it was slightly different in the implementation.

          Since this is no longer a problem in Asterisk 1.8+, I'm going to go ahead and close this out as fixed.

          Show
          Matt Jordan added a comment - This ended up getting fixed independently in r402287 in Asterisk 1.8+. Unfortunately, when it was fixed, I didn't see your patch - a very similar approach was taken, although it was slightly different in the implementation. Since this is no longer a problem in Asterisk 1.8+, I'm going to go ahead and close this out as fixed.

            People

            • Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development