Difference between revisions of "Working around seg-faults while using syslog"

From Notes_Wiki
(Created page with "=Working around seg-faults while using syslog= When we use <pre> openlog("run_commands_on_remote_server:", LOG_PID | LOG_NOWAIT | LOG_NDELAY, LOG_USER); </pre> to configure...")
 
m
Line 1: Line 1:
<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=
=Working around seg-faults while using syslog=


Line 14: Line 15:
</pre>
</pre>
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.
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>

Revision as of 05:47, 18 September 2018

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