Asterisk
  1. Asterisk
  2. ASTERISK-14926

[patch] Clean valgrind output by suppressing false errors

    Details

    • Type: Bug Bug
    • Status: Closed
    • Severity: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Target Release Version/s: None
    • Component/s: Documentation
    • Labels:
      None
    • Source Revision Number:
      221627
    • Mantis ID:
      16007
    • Regression:
      No

      Description

      There are some false errors that are flooding valgrind log.

      Attached small valgrind suppression file that filters out most common errors. It's supposed to be placed in utils/asterisk.supp but if other dir is chosen, it should be updated in valgrind.txt

      Also updated valgrind.txt so that

      • it doesn't write malloc_debug.txt from stderr (which never ever contained anything useful).
      • --log-fd is used instead of --log-file. This helps to avoid flood with "Use --log-fd=<number> to select an alternative log fd" messages.
      1. asterisk2.supp
        0.4 kB
        Atis Lezdins
      2. core-show-settings.txt
        1 kB
      3. valgrind.txt.diff
        1 kB
        Atis Lezdins
      No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

        Atis Lezdins created issue -
        Hide
        Atis Lezdins added a comment -

        Please delete first file, as that didn't had license added.

        Show
        Atis Lezdins added a comment - Please delete first file, as that didn't had license added.
        Hide
        Benny Amorsen added a comment -

        --log-fd is nice, but it means that a new start of Asterisk overwrites the log file of the crashed one... That isn't very convenient. The previous --log-file-exactly had the same problem.

        It would be ideal if valgrind could combine --log-fd and --log-file, so it opened the file itself but at a particular fd.

        Show
        Benny Amorsen added a comment - --log-fd is nice, but it means that a new start of Asterisk overwrites the log file of the crashed one... That isn't very convenient. The previous --log-file-exactly had the same problem. It would be ideal if valgrind could combine --log-fd and --log-file, so it opened the file itself but at a particular fd.
        Hide
        Atis Lezdins added a comment -

        amorsen: --log-fd means which of file descriptors valgrind will use for output.

        I'm not sure, why using --log-file creates lot of log messages saying to use --log-fd, but using --log-fd has no real disadvantages over --log-file. The only disadvantage would be that asterisk wis able to use one less file descriptor, but it donesn't use more than 3 anyway.

        Actually, You can control it just like any file descriptor, if You want to append next valgrind log to previous one, just use:

        valgrind --suppressions=/usr/src/asterisk/utils/asterisk.supp --log-fd=9 asterisk -vvvvcg 9>>valgrind.txt

        That has two >> symbols instead of one >.

        If You want to keep multiple output files, You just use

        9> valgrind.`date +%Y-%m-%d-%H:%M:%S`.txt

        Show
        Atis Lezdins added a comment - amorsen: --log-fd means which of file descriptors valgrind will use for output. I'm not sure, why using --log-file creates lot of log messages saying to use --log-fd, but using --log-fd has no real disadvantages over --log-file. The only disadvantage would be that asterisk wis able to use one less file descriptor, but it donesn't use more than 3 anyway. Actually, You can control it just like any file descriptor, if You want to append next valgrind log to previous one, just use: valgrind --suppressions=/usr/src/asterisk/utils/asterisk.supp --log-fd=9 asterisk -vvvvcg 9>>valgrind.txt That has two >> symbols instead of one >. If You want to keep multiple output files, You just use 9> valgrind.`date +%Y-%m-%d-%H:%M:%S`.txt
        Hide
        Benny Amorsen added a comment -

        The suggestion of using date is neat. Almost as good as putting the process id in the name like valgrind can do; I just have to find core files by date instead of having the file names match.

        Show
        Benny Amorsen added a comment - The suggestion of using date is neat. Almost as good as putting the process id in the name like valgrind can do; I just have to find core files by date instead of having the file names match.
        Hide
        Benny Amorsen added a comment -

        If I use --log-fd I can't get core dumps for some reason. On the other hand, with --log-file=/tmp/valgrind.%p (Careful if you copy it, it's insecure) I get core files named as /tmp/valgrind.12345.core.12345

        Show
        Benny Amorsen added a comment - If I use --log-fd I can't get core dumps for some reason. On the other hand, with --log-file=/tmp/valgrind.%p (Careful if you copy it, it's insecure) I get core files named as /tmp/valgrind.12345.core.12345
        Hide
        Leif Madsen added a comment -

        Note a bug (which I've marked as related to this issue) was opened after use of this patch.

        Show
        Leif Madsen added a comment - Note a bug (which I've marked as related to this issue) was opened after use of this patch.
        Hide
        Atis Lezdins added a comment -

        amorsen: regarding log of ASTERISK-14957 i wonder what are your compile flags. Could You paste output of "core show settings"?

        This dlclose/load_modules should be handled by suppression file, and at 0x47ADA7 should be load_dynamic_module.

        ==19410== Invalid read of size 1
        ==19410== at 0x4014881: _dl_close (in /lib64/ld-2.10.1.so)
        ==19410== by 0x400E705: _dl_catch_error (in /lib64/ld-2.10.1.so)
        ==19410== by 0x576D2BB: _dlerror_run (in /lib64/libdl-2.10.1.so)
        ==19410== by 0x576D01E: dlclose (in /lib64/libdl-2.10.1.so)
        ==19410== by 0x47ADA7: (within /usr/sbin/asterisk)
        ==19410== by 0x47B72A: (within /usr/sbin/asterisk)
        ==19410== by 0x47BC85: load_modules (in /usr/sbin/asterisk)
        ==19410== by 0x42E483: main (in /usr/sbin/asterisk)

        lmadsen: i wouldn't call this a patch, it's merely a cleaner output of debug

        Show
        Atis Lezdins added a comment - amorsen: regarding log of ASTERISK-14957 i wonder what are your compile flags. Could You paste output of "core show settings"? This dlclose/load_modules should be handled by suppression file, and at 0x47ADA7 should be load_dynamic_module. ==19410== Invalid read of size 1 ==19410== at 0x4014881: _dl_close (in /lib64/ld-2.10.1.so) ==19410== by 0x400E705: _dl_catch_error (in /lib64/ld-2.10.1.so) ==19410== by 0x576D2BB: _dlerror_run (in /lib64/libdl-2.10.1.so) ==19410== by 0x576D01E: dlclose (in /lib64/libdl-2.10.1.so) ==19410== by 0x47ADA7: (within /usr/sbin/asterisk) ==19410== by 0x47B72A: (within /usr/sbin/asterisk) ==19410== by 0x47BC85: load_modules (in /usr/sbin/asterisk) ==19410== by 0x42E483: main (in /usr/sbin/asterisk) lmadsen: i wouldn't call this a patch, it's merely a cleaner output of debug
        Hide
        Atis Lezdins added a comment -

        amorsen: did you mean - you cannot reproduce crashing, or crash occurs but there's no core dump? I usually have file named vgcore.<pid> on valgrind 3.5.0, written in dir from where valgrind is invoked.

        Show
        Atis Lezdins added a comment - amorsen: did you mean - you cannot reproduce crashing, or crash occurs but there's no core dump? I usually have file named vgcore.<pid> on valgrind 3.5.0, written in dir from where valgrind is invoked.
        Hide
        Benny Amorsen added a comment -

        I mean that I don't get a vgcore file. Probably because I run Asterisk as a service, and isn't allowed to write to the current directory (which is probably / anyway).

        Either way using --log-fd isn't an option as long as I don't get core dumps. valgrind really should respect the core_pattern sysctl or at least offer an argument for where to put the files.

        Show
        Benny Amorsen added a comment - I mean that I don't get a vgcore file. Probably because I run Asterisk as a service, and isn't allowed to write to the current directory (which is probably / anyway). Either way using --log-fd isn't an option as long as I don't get core dumps. valgrind really should respect the core_pattern sysctl or at least offer an argument for where to put the files.
        Hide
        Benny Amorsen added a comment -

        I have attached the core show settings output. If you want to reproduce the build, I have RPM's and SRPM for Fedora 11.

        Show
        Benny Amorsen added a comment - I have attached the core show settings output. If you want to reproduce the build, I have RPM's and SRPM for Fedora 11.
        Hide
        Leif Madsen added a comment -

        Switching to appropriate status as I had misunderstood what the attached files were doing

        Show
        Leif Madsen added a comment - Switching to appropriate status as I had misunderstood what the attached files were doing
        Hide
        Atis Lezdins added a comment -

        amorsen: why would you want to run valgrind all the time? it makes things really slow. And yes, You should have write access to current directory, so try starting it with command described.

        As for load_dynamic_module: it's not suppressed because you don't have all the symbols, so you should compile asterisk with DONT_OPTIMIZE and MALLOC_DEBUG as described in valgrind.txt

        Show
        Atis Lezdins added a comment - amorsen: why would you want to run valgrind all the time? it makes things really slow. And yes, You should have write access to current directory, so try starting it with command described. As for load_dynamic_module: it's not suppressed because you don't have all the symbols, so you should compile asterisk with DONT_OPTIMIZE and MALLOC_DEBUG as described in valgrind.txt
        Hide
        Benny Amorsen added a comment -

        I have to run Asterisk in valgrind for days/weeks because we are suffering from hard-to-reproduce crashes. It works surprisingly well though, apart from the fact that Asterisk is quite far from being valgrind-clean.

        I will try to set current working directory to /tmp before invoking valgrind. That may help.

        Show
        Benny Amorsen added a comment - I have to run Asterisk in valgrind for days/weeks because we are suffering from hard-to-reproduce crashes. It works surprisingly well though, apart from the fact that Asterisk is quite far from being valgrind-clean. I will try to set current working directory to /tmp before invoking valgrind. That may help.
        Hide
        Benny Amorsen added a comment -

        Update: cd /tmp before invoking valgrind works beautifully even with --log-fd. I will promptly switch to that method.

        Show
        Benny Amorsen added a comment - Update: cd /tmp before invoking valgrind works beautifully even with --log-fd. I will promptly switch to that method.
        Hide
        Digium Subversion added a comment -

        Repository: asterisk
        Revision: 225484

        A branches/1.4/contrib/valgrind.supp
        U branches/1.4/doc/valgrind.txt

        ------------------------------------------------------------------------
        r225484 | lmadsen | 2009-10-22 16:56:20 -0500 (Thu, 22 Oct 2009) | 11 lines

        Clean valgrind output by suppressing false errors.
        Update valgrind.txt documentation and add valgrind.supp file in order to
        allow those who are creating valgrind output to have less false errors in
        the logfile.

        (closes issue ASTERISK-14926)
        Reported by: atis
        Patches:
        valgrind.txt.diff uploaded by atis (license 242)
        asterisk2.supp uploaded by atis (license 242)
        Tested by: atis, amorsen
        ------------------------------------------------------------------------

        http://svn.digium.com/view/asterisk?view=rev&revision=225484

        Show
        Digium Subversion added a comment - Repository: asterisk Revision: 225484 A branches/1.4/contrib/valgrind.supp U branches/1.4/doc/valgrind.txt ------------------------------------------------------------------------ r225484 | lmadsen | 2009-10-22 16:56:20 -0500 (Thu, 22 Oct 2009) | 11 lines Clean valgrind output by suppressing false errors. Update valgrind.txt documentation and add valgrind.supp file in order to allow those who are creating valgrind output to have less false errors in the logfile. (closes issue ASTERISK-14926 ) Reported by: atis Patches: valgrind.txt.diff uploaded by atis (license 242) asterisk2.supp uploaded by atis (license 242) Tested by: atis, amorsen ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=225484
        Hide
        Digium Subversion added a comment -

        Repository: asterisk
        Revision: 225485

        _U trunk/
        A trunk/contrib/valgrind.supp
        U trunk/doc/valgrind.txt

        ------------------------------------------------------------------------
        r225485 | lmadsen | 2009-10-22 16:56:58 -0500 (Thu, 22 Oct 2009) | 19 lines

        Merged revisions 225484 via svnmerge from
        https://origsvn.digium.com/svn/asterisk/branches/1.4

        ........
        r225484 | lmadsen | 2009-10-22 16:51:52 -0500 (Thu, 22 Oct 2009) | 11 lines

        Clean valgrind output by suppressing false errors.
        Update valgrind.txt documentation and add valgrind.supp file in order to
        allow those who are creating valgrind output to have less false errors in
        the logfile.

        (closes issue ASTERISK-14926)
        Reported by: atis
        Patches:
        valgrind.txt.diff uploaded by atis (license 242)
        asterisk2.supp uploaded by atis (license 242)
        Tested by: atis, amorsen
        ........

        ------------------------------------------------------------------------

        http://svn.digium.com/view/asterisk?view=rev&revision=225485

        Show
        Digium Subversion added a comment - Repository: asterisk Revision: 225485 _U trunk/ A trunk/contrib/valgrind.supp U trunk/doc/valgrind.txt ------------------------------------------------------------------------ r225485 | lmadsen | 2009-10-22 16:56:58 -0500 (Thu, 22 Oct 2009) | 19 lines Merged revisions 225484 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r225484 | lmadsen | 2009-10-22 16:51:52 -0500 (Thu, 22 Oct 2009) | 11 lines Clean valgrind output by suppressing false errors. Update valgrind.txt documentation and add valgrind.supp file in order to allow those who are creating valgrind output to have less false errors in the logfile. (closes issue ASTERISK-14926 ) Reported by: atis Patches: valgrind.txt.diff uploaded by atis (license 242) asterisk2.supp uploaded by atis (license 242) Tested by: atis, amorsen ........ ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=225485
        Hide
        Digium Subversion added a comment -

        Repository: asterisk
        Revision: 225486

        A branches/1.6.0/contrib/valgrind.supp
        U branches/1.6.0/doc/valgrind.txt

        ------------------------------------------------------------------------
        r225486 | lmadsen | 2009-10-22 16:57:50 -0500 (Thu, 22 Oct 2009) | 26 lines

        Merged revisions 225485 via svnmerge from
        https://origsvn.digium.com/svn/asterisk/trunk

        ................
        r225485 | lmadsen | 2009-10-22 16:52:30 -0500 (Thu, 22 Oct 2009) | 19 lines

        Merged revisions 225484 via svnmerge from
        https://origsvn.digium.com/svn/asterisk/branches/1.4

        ........
        r225484 | lmadsen | 2009-10-22 16:51:52 -0500 (Thu, 22 Oct 2009) | 11 lines

        Clean valgrind output by suppressing false errors.
        Update valgrind.txt documentation and add valgrind.supp file in order to
        allow those who are creating valgrind output to have less false errors in
        the logfile.

        (closes issue ASTERISK-14926)
        Reported by: atis
        Patches:
        valgrind.txt.diff uploaded by atis (license 242)
        asterisk2.supp uploaded by atis (license 242)
        Tested by: atis, amorsen
        ........
        ................

        ------------------------------------------------------------------------

        http://svn.digium.com/view/asterisk?view=rev&revision=225486

        Show
        Digium Subversion added a comment - Repository: asterisk Revision: 225486 A branches/1.6.0/contrib/valgrind.supp U branches/1.6.0/doc/valgrind.txt ------------------------------------------------------------------------ r225486 | lmadsen | 2009-10-22 16:57:50 -0500 (Thu, 22 Oct 2009) | 26 lines Merged revisions 225485 via svnmerge from https://origsvn.digium.com/svn/asterisk/trunk ................ r225485 | lmadsen | 2009-10-22 16:52:30 -0500 (Thu, 22 Oct 2009) | 19 lines Merged revisions 225484 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r225484 | lmadsen | 2009-10-22 16:51:52 -0500 (Thu, 22 Oct 2009) | 11 lines Clean valgrind output by suppressing false errors. Update valgrind.txt documentation and add valgrind.supp file in order to allow those who are creating valgrind output to have less false errors in the logfile. (closes issue ASTERISK-14926 ) Reported by: atis Patches: valgrind.txt.diff uploaded by atis (license 242) asterisk2.supp uploaded by atis (license 242) Tested by: atis, amorsen ........ ................ ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=225486
        Hide
        Digium Subversion added a comment -

        Repository: asterisk
        Revision: 225487

        A branches/1.6.1/contrib/valgrind.supp
        U branches/1.6.1/doc/valgrind.txt

        ------------------------------------------------------------------------
        r225487 | lmadsen | 2009-10-22 16:58:28 -0500 (Thu, 22 Oct 2009) | 26 lines

        Merged revisions 225485 via svnmerge from
        https://origsvn.digium.com/svn/asterisk/trunk

        ................
        r225485 | lmadsen | 2009-10-22 16:52:30 -0500 (Thu, 22 Oct 2009) | 19 lines

        Merged revisions 225484 via svnmerge from
        https://origsvn.digium.com/svn/asterisk/branches/1.4

        ........
        r225484 | lmadsen | 2009-10-22 16:51:52 -0500 (Thu, 22 Oct 2009) | 11 lines

        Clean valgrind output by suppressing false errors.
        Update valgrind.txt documentation and add valgrind.supp file in order to
        allow those who are creating valgrind output to have less false errors in
        the logfile.

        (closes issue ASTERISK-14926)
        Reported by: atis
        Patches:
        valgrind.txt.diff uploaded by atis (license 242)
        asterisk2.supp uploaded by atis (license 242)
        Tested by: atis, amorsen
        ........
        ................

        ------------------------------------------------------------------------

        http://svn.digium.com/view/asterisk?view=rev&revision=225487

        Show
        Digium Subversion added a comment - Repository: asterisk Revision: 225487 A branches/1.6.1/contrib/valgrind.supp U branches/1.6.1/doc/valgrind.txt ------------------------------------------------------------------------ r225487 | lmadsen | 2009-10-22 16:58:28 -0500 (Thu, 22 Oct 2009) | 26 lines Merged revisions 225485 via svnmerge from https://origsvn.digium.com/svn/asterisk/trunk ................ r225485 | lmadsen | 2009-10-22 16:52:30 -0500 (Thu, 22 Oct 2009) | 19 lines Merged revisions 225484 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r225484 | lmadsen | 2009-10-22 16:51:52 -0500 (Thu, 22 Oct 2009) | 11 lines Clean valgrind output by suppressing false errors. Update valgrind.txt documentation and add valgrind.supp file in order to allow those who are creating valgrind output to have less false errors in the logfile. (closes issue ASTERISK-14926 ) Reported by: atis Patches: valgrind.txt.diff uploaded by atis (license 242) asterisk2.supp uploaded by atis (license 242) Tested by: atis, amorsen ........ ................ ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=225487
        Hide
        Digium Subversion added a comment -

        Repository: asterisk
        Revision: 225488

        A branches/1.6.2/contrib/valgrind.supp
        U branches/1.6.2/doc/valgrind.txt

        ------------------------------------------------------------------------
        r225488 | lmadsen | 2009-10-22 16:58:50 -0500 (Thu, 22 Oct 2009) | 26 lines

        Merged revisions 225485 via svnmerge from
        https://origsvn.digium.com/svn/asterisk/trunk

        ................
        r225485 | lmadsen | 2009-10-22 16:52:30 -0500 (Thu, 22 Oct 2009) | 19 lines

        Merged revisions 225484 via svnmerge from
        https://origsvn.digium.com/svn/asterisk/branches/1.4

        ........
        r225484 | lmadsen | 2009-10-22 16:51:52 -0500 (Thu, 22 Oct 2009) | 11 lines

        Clean valgrind output by suppressing false errors.
        Update valgrind.txt documentation and add valgrind.supp file in order to
        allow those who are creating valgrind output to have less false errors in
        the logfile.

        (closes issue ASTERISK-14926)
        Reported by: atis
        Patches:
        valgrind.txt.diff uploaded by atis (license 242)
        asterisk2.supp uploaded by atis (license 242)
        Tested by: atis, amorsen
        ........
        ................

        ------------------------------------------------------------------------

        http://svn.digium.com/view/asterisk?view=rev&revision=225488

        Show
        Digium Subversion added a comment - Repository: asterisk Revision: 225488 A branches/1.6.2/contrib/valgrind.supp U branches/1.6.2/doc/valgrind.txt ------------------------------------------------------------------------ r225488 | lmadsen | 2009-10-22 16:58:50 -0500 (Thu, 22 Oct 2009) | 26 lines Merged revisions 225485 via svnmerge from https://origsvn.digium.com/svn/asterisk/trunk ................ r225485 | lmadsen | 2009-10-22 16:52:30 -0500 (Thu, 22 Oct 2009) | 19 lines Merged revisions 225484 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r225484 | lmadsen | 2009-10-22 16:51:52 -0500 (Thu, 22 Oct 2009) | 11 lines Clean valgrind output by suppressing false errors. Update valgrind.txt documentation and add valgrind.supp file in order to allow those who are creating valgrind output to have less false errors in the logfile. (closes issue ASTERISK-14926 ) Reported by: atis Patches: valgrind.txt.diff uploaded by atis (license 242) asterisk2.supp uploaded by atis (license 242) Tested by: atis, amorsen ........ ................ ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=225488
        Erin Spiceland made changes -
        Field Original Value New Value
        issue.field.mantisimportkey 16007 38694
        Erin Spiceland made changes -
        Workflow jira [ 80514 ] Subtask and Courtesy Workflow [ 106228 ]
        Erin Spiceland made changes -
        Assignee Leif Madsen [ lmadsen ]

          People

          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: