Working around seg-faults while using syslog
<yambe:breadcrumb self="Working around seg-faults while using syslog">Using syslog library with C|Using syslog library with C</yambe:breadcrumb>
Working around seg-faults while using syslog
When we use
openlog("run_commands_on_remote_server:", LOG_PID | LOG_NOWAIT | LOG_NDELAY, LOG_USER);
to configure syslog, then many times we may see lines like
May 2 10:39:27 basehost2 kernel: watchdog[7327]: segfault at 00000000000000c0 rip 0000003f72853784 rsp 00007fff9519dcb0 error 4
in '/var/log/messages'. These are not easy to resolve. Hence a simple work around is to add
`sleep 3`
at end of command being run to create a three second delay in running command. This seems to solve the segfault problem. Note that most probably the segfault is due to bug in kernel or logging system, etc. Hence it cannot be solved by modifing code. The same code runs fine sometimes and at other times it gives this error. Adding sleep stops error everytime and hence is very useful.
<yambe:breadcrumb self="Working around seg-faults while using syslog">Using syslog library with C|Using syslog library with C</yambe:breadcrumb>