Bug 855240

Summary: Upstart gives up respawning; want it to try forever
Product: Red Hat Enterprise Linux 6 Reporter: Nick Urbanik <nicku>
Component: upstartAssignee: Lukáš Nykrýn <lnykryn>
Status: CLOSED WONTFIX QA Contact: qe-baseos-daemons
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.3CC: kjw, penguin-kernel
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-10-13 11:09:27 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Nick Urbanik 2012-09-07 04:45:01 UTC
Description of problem:
The previous /sbin/init would retry a failed respawn job forever; it would stop for five minutes, then continue; upstart offers no such facility.

Version-Release number of selected component (if applicable):
upstart-0.6.5-12.el6.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Set up a task that should respawn, even if it fails
2. upstart has no "respawn forever" option
3. temporary network problem causes a vital process to completely fail
  
Actual results:
Respawn has a hard limit that results in the job stopping after exceeding that limit

Expected results:
respawn should provide an option to keep trying with some kind of rate limiting

Additional info:
See https://bugs.launchpad.net/upstart/+bug/252997

This is a major problem for us, as upstart has unexpectedly abandoned various vital jobs; we now need to create monitoring for this, whereas with the previous inittab respawn, this was not necessary.

Comment 2 Lukáš Nykrýn 2012-09-07 08:35:46 UTC
Easiest solution would be setting 'respawn limit' to more tolerant value.

Comment 3 Nick Urbanik 2012-09-11 02:09:17 UTC
(In reply to comment #2)
> Easiest solution would be setting 'respawn limit' to more tolerant value.

What we need is 'forever'.  Setting it to a finite value is not a solution.

There is a patch in the launchpad bug referenced.

Comment 4 Lukáš Nykrýn 2012-09-17 11:16:15 UTC
We are probably not planning to update upstart in next release, but you can also create second job which will be launched when the main job fails and stops respawning, and watch for network to go online again.


::::::::::::::
job.conf
::::::::::::::
start on startup or mycheck FILE=exists
script
	while [ -e /tmp/aaa ]; do sleep 1; done
end script
respawn

::::::::::::::
test.conf
::::::::::::::
start on stopped job
script
	echo "File disappeared"
	while [ ! -e /tmp/aaa ]; do sleep 10; done
	echo "File appeared"
	initctl emit mycheck FILE=exists
end script

Comment 5 Tetsuo Handa 2013-07-01 12:16:20 UTC
I want "respawn forever" option too.

Say, an unprivileged user is operating on console login. He used nested shells
(bash -> bash -> bash), and he finished his job. He pressed Ctrl-D for three
seconds so that all the nested shells are exited and he can completely log out
and the login prompt will appear. What will he get?

He gets a login prompt which no longer responds (because the mingetty process
is no longer respawned, like /var/log/messages says "init: tty (/dev/ttyX)
respawning too fast, stopped"). He can never login again from that tty. ;-(

(If he is malicious, he can kill all console ttys so that nobody can login from
console.)

Comment 6 RHEL Program Management 2013-10-14 00:28:36 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unable to address this
request at this time.

Red Hat invites you to ask your support representative to
propose this request, if appropriate, in the next release of
Red Hat Enterprise Linux.

Comment 7 Lukáš Nykrýn 2015-10-13 11:09:27 UTC
The original patch was never accepted upstream.