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
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
=Working around seg-faults while using syslog=
[[Main_Page|Home]] > [[C|C programming language]] > [[Using syslog library with C]] > [[Working around seg-faults while using syslog]]


When we use
When we use
Line 14: Line 14:
</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.
[[Main_Page|Home]] > [[C|C programming language]] > [[Using syslog library with C]] > [[Working around seg-faults while using syslog]]

Latest revision as of 13:28, 7 April 2022

Home > C programming language > Using syslog library with C > 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.


Home > C programming language > Using syslog library with C > Working around seg-faults while using syslog