[libvirt] [PATCH] virlog: Add stack trace log when libvirt receives fatal signal

Martin Kletzander mkletzan at redhat.com
Wed May 21 10:39:55 UTC 2014


On Wed, May 21, 2014 at 09:37:35AM +0000, Wangrui (K) wrote:
>
>> -----Original Message-----
>> From: Daniel P. Berrange [mailto:berrange at redhat.com]
>> Sent: Tuesday, May 20, 2014 5:05 PM
>> To: Wangrui (K)
>> Cc: libvir-list at redhat.com; zhouyimin Zhou(Yimin); Yanqiangjun
>> Subject: Re: [PATCH] virlog: Add stack trace log when libvirt receives fatal signal
>>
>> On Tue, May 20, 2014 at 08:59:37AM +0000, Wangrui (K) wrote:
>> > An earlier commit(c0c8c1) Dan removed global log buffer feature entirely
>> > because of duplicate log messages. An improvement is introduced. That is
>> > dumping stack trace instead of log buffer upon libvirt crash.
>>
>>
>> This is not going to work. virLogStackTraceToFd invokes the
>> backtrace/backtrace_symbols_fd functions which are not async
>> signal safe. They are also not likely to be reliable to use
>> when you have memory corruption triggering the signal.
>>
>> The 'abrt' program is commonly used on modern Linux distros to
>> generate stack traces when processes crash / terminate abnormally.
>> abrt has the added benefit that the stack traces it records include
>> all function parameters and local variables.
>>
>
>Oops.
>I didn't realize Async-signal-(un)safe functions in virLogStackTraceToFd.
>And it seems that only kernel coredump can be used in this case.
>My original purpose is to trace stack on crash/obort and etc without
>using kernel.core_pattern (sometimes kernel coredump is not turned on ).
>

If you use '| /full/path/to/script_that_gets_coredump_on_stdin' for
the kernel.core_pattern, it will work even when ulimit is turned off.
In that script you can throw away all the coredumps you don't want and
capture only those you want and only when you want.  You can use
default percent syntax to specify parameters for the script and base
the decision on that.

Martin

>Thanks.
>
>> Regards,
>> Daniel
>> --
>> |: http://berrange.com      -o-
>> http://www.flickr.com/photos/dberrange/ :|
>> |: http://libvirt.org              -o-
>> http://virt-manager.org :|
>> |: http://autobuild.org       -o-
>> http://search.cpan.org/~danberr/ :|
>> |: http://entangle-photo.org       -o-
>> http://live.gnome.org/gtk-vnc :|
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140521/c12597b8/attachment-0001.sig>


More information about the libvir-list mailing list