[ovs-dev] [PATCH] fatal-signal: Log backtrace when no monitor daemon.

Ben Pfaff blp at ovn.org
Mon Mar 23 15:37:09 UTC 2020

On Mon, Mar 23, 2020 at 08:16:30AM -0700, William Tu wrote:
> Currently the backtrace logging is only available when monitor
> daemon is running.  This patch enables backtrace logging when
> no monitor daemon exists.  At signal handling context, it detects
> whether monitor daemon exists.  If not, write directly the backtrace
> to the vlog fd.  Note that using VLOG_* macro doesn't work due to
> it's buffer I/O, so this patch directly issue write() syscall to
> the file descriptor.
> Signed-off-by: William Tu <u9012063 at gmail.com>
> ---
> For some system we stop using monitor daemon and use systemd to monitor
> ovs-vswitchd, thus need this patch. Example of ovs-vswitchd.log:
> 2020-03-23T14:42:12.949Z|00049|memory|INFO|175332 kB peak resident set size after 10.0 seconds
> 2020-03-23T14:42:12.949Z|00050|memory|INFO|handlers:2 ports:3 revalidators:2 rules:8 udpif keys:8
> SIGSEGV detected, backtrace:
> 0x0000000000486969 <fatal_signal_handler+0x49>
> 0x00007f7f5e57f4b0 <killpg+0x40>
> 0x000000000047daa8 <pmd_thread_main+0x238>
> 0x0000000000504edd <ovsthread_wrapper+0x7d>
> 0x00007f7f5f0476ba <start_thread+0xca>
> 0x00007f7f5e65141d <clone+0x6d>
> 0x0000000000000000 <+0x0>

It looks the above isn't part of the commit message, but it would be
valuable as part of it.

It looks like this assumes that there is always a vlog_fd, but this
isn't necessarily so.  If vlog_fd < 0, then nothing should be written.
(I guess it's harmless to write to fd -1, but pointless and weird.)

More information about the dev mailing list