[Home]

Summary:ASTERISK-14926: [patch] Clean valgrind output by suppressing false errors
Reporter:Atis Lezdins (atis)Labels:
Date Opened:2009-10-01 13:06:13Date Closed:2009-10-22 16:58:51
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Documentation
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) asterisk2.supp
( 1) core-show-settings.txt
( 2) valgrind.txt.diff
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.



Comments:By: Atis Lezdins (atis) 2009-10-01 13:08:28

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

By: Benny Amorsen (amorsen) 2009-10-06 04:04:25

--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.

By: Atis Lezdins (atis) 2009-10-06 04:26:15

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



By: Benny Amorsen (amorsen) 2009-10-07 13:56:50

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.

By: Benny Amorsen (amorsen) 2009-10-08 03:07:45

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

By: Leif Madsen (lmadsen) 2009-10-08 07:11:00

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

By: Atis Lezdins (atis) 2009-10-08 07:19:03

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 :)

By: Atis Lezdins (atis) 2009-10-08 07:22:03

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.

By: Benny Amorsen (amorsen) 2009-10-08 07:36:20

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.

By: Benny Amorsen (amorsen) 2009-10-08 07:38:06

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

By: Leif Madsen (lmadsen) 2009-10-20 09:16:27

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

By: Atis Lezdins (atis) 2009-10-22 08:30:43

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

By: Benny Amorsen (amorsen) 2009-10-22 08:37:20

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.

By: Benny Amorsen (amorsen) 2009-10-22 09:18:57

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

By: Digium Subversion (svnbot) 2009-10-22 16:56:20

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

By: Digium Subversion (svnbot) 2009-10-22 16:56:58

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

By: Digium Subversion (svnbot) 2009-10-22 16:57:50

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

By: Digium Subversion (svnbot) 2009-10-22 16:58:28

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

By: Digium Subversion (svnbot) 2009-10-22 16:58:50

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