On Tue, May 20, 2014 at 10:05:19AM +0100, Daniel P. Berrange wrote:
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.While I understand the desire here...+virLogDumpAllFD(const char *msg, int len) +{ + size_t i; + bool found = false; + + if (len <= 0) + len = strlen(msg); + + for (i = 0; i < virLogNbOutputs; i++) { + if (virLogOutputs[i].f == virLogOutputToFd) { + int fd = (intptr_t) virLogOutputs[i].data; + + if (fd >= 0) { + if (msg) + ignore_value(safewrite(fd, msg, len)); + else + virLogStackTraceToFd(fd); + + found = true; + } + } + } + if (!found) { + if (msg) + ignore_value(safewrite(STDERR_FILENO, msg, len)); + else + virLogStackTraceToFd(STDERR_FILENO);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.
And if you can't (or don't want to) have abrt then it is pretty easy to make a self-created solution using kernel.core_pattern in /etc/sysctl.conf
Regards, Daniel
Attachment:
signature.asc
Description: Digital signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list