I''m having this issue where "puppetd -v -o" hangs (won''t return my prompt) when starting a daemon I wrote. If puppetd is running as a daemon a zombie process is created each time puppetd tries to start my daemon. Puppet detects when the daemon is down and starts it just fine. I''m using version 0.22.3 on RHEL 5. Here''s the class. I''ve tried modifying "service" by specifying the start command as "/root/bin/chkpuppet_repo.sh &" and the "hang" behavior did not change. Any ideas as to why this is happening? class puppetmaster_files { file {"/root/bin/chkpuppet_repo.sh": owner => root, group => root, mode => 0750, source => "puppet://example.com/prod/puppet/root/bin/chkpuppet_repo.sh" } service { chkpuppet_repo: subscribe => File["/root/bin/chkpuppet_repo.sh"], ensure => running } } Here is the start script. http://pastie.caboo.se/57095 Thanks, Kent
On 4/27/07, Kenton Brede <kbrede@gmail.com> wrote:> I''m having this issue where "puppetd -v -o" hangs (won''t return my > prompt) when starting a daemon I wrote. If puppetd is running as a > daemon a zombie process is created each time puppetd tries to start my > daemon. Puppet detects when the daemon is down and starts it just > fine. I''m using version 0.22.3 on RHEL 5.<snip>> service { chkpuppet_repo: > subscribe => File["/root/bin/chkpuppet_repo.sh"], > ensure => running > } > }I''ve done some more research. My daemon is just a while loop in a shell script. So if I create a test daemon: ------------------------- #!/bin/bash while true; do sleep 25 done & ------------------------ Kill the daemon with my init.d script, fire up "puppetd -v -o" puppetd hangs on the command line with the following ps output: 24224 pts/0 Sl+ 0:05 /usr/bin/ruby /usr/sbin/puppetd -v -o 24264 pts/0 Z+ 0:00 [chkpuppet_repo] <defunct> 24273 pts/0 S+ 0:00 /bin/bash /root/bin/chkpuppet_repo.sh Of course when I ctrl-c out of puppetd the chkpuppet_repo.sh script dies. My init.d script works fine from the command line. I''ve tried backgrounding the job from within the init.d script. This results in the same ps output as above but when I ctrl-c out of puppetd then the job still runs and the defunct job is removed. I''ve also tried "start => "/root/bin/chkpuppet_repo.sh &"" from within "service" and that didn''t work either. So how do I get this job to background properly when puppetd runs? Thanks, Kent
On Apr 27, 2007, at 1:52 PM, Kenton Brede wrote:> > I''ve done some more research. My daemon is just a while loop in a > shell script. > > So if I create a test daemon: > > ------------------------- > #!/bin/bash > while true; do > sleep 25 > done & > ------------------------ > > Kill the daemon with my init.d script, fire up "puppetd -v -o" puppetd > hangs on the command line with the following ps output: > > 24224 pts/0 Sl+ 0:05 /usr/bin/ruby /usr/sbin/puppetd -v -o > 24264 pts/0 Z+ 0:00 [chkpuppet_repo] <defunct> > 24273 pts/0 S+ 0:00 /bin/bash /root/bin/chkpuppet_repo.sh > > Of course when I ctrl-c out of puppetd the chkpuppet_repo.sh script > dies. My init.d script works fine from the command line. > > I''ve tried backgrounding the job from within the init.d script. This > results in the same ps output as above but when I ctrl-c out of > puppetd then the job still runs and the defunct job is removed. > > I''ve also tried "start => "/root/bin/chkpuppet_repo.sh &"" from within > "service" and that didn''t work either.Is it possible to see if this works in SVN? I hopehopehope that the work Jeff McCune did to the execute() method fixes this. -- Love is the triumph of imagination over intelligence. -- H. L. Mencken --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com
Luke Kanies wrote:> Is it possible to see if this works in SVN? I hopehopehope that the > work Jeff McCune did to the execute() method fixes this.To provide some more information on the problem: Puppet used to fork a copy of itself, then call Kernel.exec() in the child to overwrite the binary with the program to execute. The parent then attempted an IO.read() to capture the standard output and error pipes coming from the child. If the child was signaled rather than exited normally, e.g. it was killed by another process, the parent would not reap the SIGCHLD signal since it was blocked trying to read, causing the hang. The problem is actually still there, the solution I wrote works around the issue by only calling IO.read if you tell puppet to capture the output of your process. So, if you don''t care about the output, you should be good to go at this point. -- Jeff McCune The Ohio State University Department of Mathematics Systems Manager _______________________________________________ Puppet-users mailing list Puppet-users@madstop.com https://mail.madstop.com/mailman/listinfo/puppet-users
On 4/27/07, Luke Kanies <luke@madstop.com> wrote:> On Apr 27, 2007, at 1:52 PM, Kenton Brede wrote: > > > > I''ve done some more research. My daemon is just a while loop in a > > shell script. > > > > So if I create a test daemon: > > > > ------------------------- > > #!/bin/bash > > while true; do > > sleep 25 > > done & > > ------------------------ > > > > Kill the daemon with my init.d script, fire up "puppetd -v -o" puppetd > > hangs on the command line with the following ps output: > > > > 24224 pts/0 Sl+ 0:05 /usr/bin/ruby /usr/sbin/puppetd -v -o > > 24264 pts/0 Z+ 0:00 [chkpuppet_repo] <defunct> > > 24273 pts/0 S+ 0:00 /bin/bash /root/bin/chkpuppet_repo.sh > > > > Of course when I ctrl-c out of puppetd the chkpuppet_repo.sh script > > dies. My init.d script works fine from the command line. > > > > I''ve tried backgrounding the job from within the init.d script. This > > results in the same ps output as above but when I ctrl-c out of > > puppetd then the job still runs and the defunct job is removed. > > > > I''ve also tried "start => "/root/bin/chkpuppet_repo.sh &"" from within > > "service" and that didn''t work either. > > Is it possible to see if this works in SVN? I hopehopehope that the > work Jeff McCune did to the execute() method fixes this.Sorry I''m crushed at work ATM and didn''t have time to set up a test box to test the SVN instance. I did upgrade to 0.22.4 this morning on the server and the problem is fixed. Thanks all :) Kent
On May 3, 2007, at 11:34 AM, Kenton Brede wrote:> Sorry I''m crushed at work ATM and didn''t have time to set up a test > box to test the SVN instance. I did upgrade to 0.22.4 this morning on > the server and the problem is fixed.Woot! Now if only we could figure out #616[1]. 1 - https://reductivelabs.com/trac/puppet/ticket/616 -- I used to get high on life but lately I''ve built up a resistance. --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com