| View previous topic :: View next topic |
| Author |
Message |
Demosthenex n00b

Joined: 11 Sep 2002 Posts: 14 Location: Houston, TX
|
Posted: Mon Sep 22, 2003 3:44 pm Post subject: cfengine process restart hang, runscript, and open files. |
|
|
I'm experimenting with using cfengine under Gentoo and am having
problems when restarting processes with the scripts in /etc/init.d.
cfengine can check for specific processes under varying criteria on a
given schedule, and among other things, restart that process using a
restart command if the process is missing.
The problem that occurs is when cfengine uses a script in /etc/init.d
to restart a failed/missing process, cfengine hangs. This is due to a
known issue with bad daemons leaving file descriptors open.
Here's the relevant portion of my config:
processes:
"/usr/sbin/syslog-ng"
restart "/etc/init.d/syslog-ng zap start"
matches=1
useshell=false
inform=true
The intent is that if syslog-ng isn't running, cfengine will restart
it using the restart command. Upon its scheduled execution cfengine
does detect the lack of syslog-ng, and calls the restart command. At
that point, cfengine hangs, waiting for the restart command to finish
and return.
This is very similar to when you start certain programs in the
background over an ssh connection, and though you try to logout, ssh
is still waiting for something.
So, I've varied the restart command. It has worked successfully
calling the syslog-ng binary directly, and using the line from
/etc/init.d/syslog-ng, that uses start-stop-daemon to launch
syslog-ng.
It seems the culprit is in /sbin/runscript, which is the interpreter
for all the /etc/init.d/* scripts. I believe if it would simply close
all open files before exiting, this would work cleanly. In the mean
time, all scripts in /etc/init.d are broken like this.
Here is a link to a relevant article on the same problem.
http://www.openldap.org/lists/openldap-devel/200001/msg00014.html
Comments and suggestions are welcome.
Demo |
|
| Back to top |
|
 |
delta407 Bodhisattva


Joined: 23 Apr 2002 Posts: 2876 Location: Chicago, IL
|
Posted: Mon Sep 22, 2003 5:34 pm Post subject: Re: cfengine process restart hang, runscript, and open files |
|
|
| Demosthenex wrote: | It seems the culprit is in /sbin/runscript, which is the interpreter for all the /etc/init.d/* scripts. I believe if it would simply close all open files before exiting, this would work cleanly. In the mean time, all scripts in /etc/init.d are broken like this.
Here is a link to a relevant article on the same problem.
http://www.openldap.org/lists/openldap-devel/200001/msg00014.html
Comments and suggestions are welcome. | I would file a bug report so you can talk to a developer about this. That's the best way to get in touch with someone that can help -- for instance, the people that maintain /sbin/runscript.
Also, if you file a bug, please add a link to it in this thread.  _________________ I don't believe in witty sigs. |
|
| Back to top |
|
 |
Demosthenex n00b

Joined: 11 Sep 2002 Posts: 14 Location: Houston, TX
|
Posted: Mon Sep 22, 2003 9:24 pm Post subject: Re: cfengine process restart hang, runscript, and open files |
|
|
| Demosthenex wrote: |
processes:
"/usr/sbin/syslog-ng"
restart "/etc/init.d/syslog-ng zap start"
matches=1
useshell=false
inform=true
|
Ah ha! Solved it! It appears to be that runscript is leaving STDERR open, and the following config entry works like a charm.
processes:
"/usr/sbin/syslog-ng"
restart "/etc/init.d/syslog-ng zap start 2<&-"
matches=1
useshell=true
inform=true
Forcing the process to start in a shell, then forcing the shell to close STDERR ("2<&-"), it returns cleanly.
A more extreme example would be to use "0<&- 1<&- 2<&-", forcing all standard file handles closed, but I really don't think thats required in this case.
Demo |
|
| Back to top |
|
 |
wdsl n00b

Joined: 18 Jan 2007 Posts: 1
|
Posted: Thu Jan 18, 2007 10:10 am Post subject: |
|
|
Hi,
can your solution cause any Problem?
It works fine on our test stystem but i'm a little bit afraid that this cause any not tested problems.
thx
wdsl |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|