/srv/irclogs.ubuntu.com/2012/07/04/#upstart.txt

pmjdebru1jnis there an upstart config file too? so these parameters won't have to be passed on the kernel commandline?06:39
=== Guest59153 is now known as kklimonda
intgrHi! So I have a custom init conf script. Whatever I do, upstart doesn't even attempt to start the service. It just says it's either "start/killed" or "stop/killed" with the same old PID, every time.10:15
intgrhttp://codepad.org/3oSxyR4p10:20
intgrThe PID doesn't even change when I try to start/stop it10:21
intgrNothing gets written to syslog or /var/log/upstart/daemonlogger.log10:21
intgrNor is there a "daemonlogger" process10:21
intgrAnd the process 11920 hasn't existed for ages10:24
intgrOh great, now I ran "reboot" and it hung at "Asking all remaining processes to terminate..."10:26
intgrWell the service used to include "expect fork" in it. When I re-add that back I can reproduce this problem, which seems like a bug.10:34
jodhintgr: take a look at http://upstart.ubuntu.com/cookbook/#precepts-for-creating-a-job-configuration-file, http://upstart.ubuntu.com/cookbook/#determining-the-value-of-expect.10:41
jodhintgr: as the cookbook mentions, never add "respawn" until you are convinced the job is behaving correctly.10:42
jodhAlso, please see http://upstart.ubuntu.com/cookbook/#checking-how-a-service-might-react-when-run-as-a-job10:42
intgrjodh: Regardless, a bad configuration file shouldn't prevent the machine from rebooting, no?10:42
intgr?c10:42
jodhintgr: it shouldn't.10:44
jodhintgr: at a guess, I'd say your daemonlogger is forking and then dying. You need to know how many times it forks - http://upstart.ubuntu.com/cookbook/#how-to-establish-fork-count10:46
intgrI'll just exec it without daemonization, hopefully then Upstart won't crash10:47
jodhintgr: I don't think Upstart is crashing here - you'll get a kernel panic if it is.10:48
intgrWell a hung reboot is a "crash" in my mind.10:48
jodhintgr: if you are running on Ubuntu, that shouldn't be possible.10:51
intgrUbuntu 12.04, up to date.10:51
jodhintgr: please raise a bug with full step-by-step details on how to recreate then.10:52
intgrMy reset button is wearing out already...10:53
intgr:)10:53
intgrjodh: Any ideas how to fix this without a cold reboot? I already started this job on our live server.10:59
jodhintgr: the links above explain how to build up a .conf file. I suggest you try to run daemonlogger outside of Upstart (http://upstart.ubuntu.com/cookbook/#checking-how-a-service-might-react-when-run-as-a-job) and once you have that working and know how many times it forks, start testing your .conf job without 'respawn' initially.11:23
jodhintgr: or are you referring to how to reboot your system?11:23
intgrjodh: I mean how do I fix upstart so the next shutdown won't hang forever.11:40
jodhintgr: well, since I don't know what is causing the hang, difficult to say aside from disabling the job you are developing.11:51
intgrOk...11:56
intgrjodh: Do you want to try to reproduce? http://codepad.org/lgj4aS2j12:16
jodhintgr: I cannot recreate your hang - even mis-specifying the .conf file does not cause a problem on shutdown.12:32
jodhintgr: looks like daemonlogger is only forking once btw so your job should specify "expect fork".12:32
intgrjodh: Same thing happens when I use "expect fork"12:37
jodhintgr: try creating a fresh 12.04 install as I suspect something else has changed on your system. If that still fails, please raise a bug with full details.12:38
intgrThis is pretty fresh -- I just cloned it from our VM template (which is a clean 12.04 install with a few additional services)12:39
jodhintgr: what services? does a clean cloned system with no daemonlogger.conf reliably shut down?12:40
intgrAnd the machine I initially experienced this on was installed yesterday, with a different configuration.12:40
intgrIf I remove the daemonlogger.conf file, it shuts down nicely again.12:40
intgrOr if I simply don't start the service12:40
intgrOh, and the "stop daemonlogger" command is necessary too -- it doesn't hang if I don't run that.12:41
intgrDid you run that?12:41
intgrThe VM template has acpid, atop, ntpd and is using linux-virtual kernel12:43
jodhintgr: ah - because you're running "stop", but that can never complete successfully (as you've mis-specified 'expect'), yes Upstart will wait until it gets confirmation your process has ended.12:49
intgrAnd this prevents shutdown, too?12:49
jodhIn the scenario where a user has manually run 'stop', not interrupted it, mis-specified 'expect' and not specified 'stop on'... yes.12:53
jodhintgr: please raise a bug so we can try to find a way to identify such jobs and handle them.12:53
intgrSure12:54
intgrThanks for being heplful :)12:54
jodhintgr: np. Your job prolly wants to look something like this: http://paste.ubuntu.com/1074736/12:58
jodhintgr: ... although, putting logs in /tmp prolly isn't such a good idea ;)12:58
intgr:)12:58
jodhintgr: in fact that "pre-start script" can be just "pre-start exec mkdir $dir". It'll be handled the same internally, but it's results in a cleaner conf file.12:59
intgrjodh: Does "expect" work with "script/end script"?12:59
jodhintgr: "yes", but be careful since Upstart starts counting forks immediately so if your script starts by doing something like "var=$(cat /etc/somefile)", Upstart will follow the fork of /bin/cat - not what you want.13:00
intgrI see13:00
jodhintgr: but crucially 'expect' only works for the "main" exec or script section. Hence, makes sense to do setup in pre-start for example.13:01
intgrjodh: Well it works with exec, but still not with script: http://paste.ubuntu.com/1074741/13:04
intgrOh, it doesn't hang anymore, just doesn't get the right PID13:04
jodhintgr: you can overcome that issue btw by having 2 conf files - one which does the setup and reads files, etc and then runs "start job2 var1=a var2=b varc='hello world'" or similar. All those variables will be available to job2 which can just do "exec mydaemon -l $var1 -i $var2" and specify "respawn" too.13:04
jodhintgr: if the pid is incorrect, you've mis-specified expect somehow.13:05
intgrI'm using "expect fork" just like you did13:05
jodhintgr: you need "exec daemonlogger" *within* that script section.13:05
intgrAh ok13:06
intgrjodh: https://bugs.launchpad.net/upstart/+bug/102095113:17
jodhintgr: thanks.13:18
benbrohow can I run a service only after postgresql is running?14:28
benbroI currently have this in my upstart script:14:28
benbrostart on (local-filesystems and net-device-up IFACE!=lo)14:28
jodhbenbro: nominally, "start on stopped rc" (since postgresql is a SysV service in Ubuntu atm I think).14:31
jodhbenbro: however, that assumes that when the postgresql SysV service script finishes that the postgresql server is ready to accept connections.14:32
benbrojodh: and it is not always the case?14:41
intgrbenbro: I believe the Ubuntu Postgres init script returns immediately after launching postmaster.14:56
intgrIf your machine crashes/loses power, Postgres has to perform recovery at startup, which can take a long time14:56
intgr(depending on your checkpoint_* settings)14:56
benbrointgr: so there is no way to start my service after postgres?14:58
benbrointgr: maybe my service should just retry creating the connection14:58
intgrYeah, that's what I do14:59
benbrothanks14:59
benbroin that case I should still use "start on stopped rc" or something else?14:59
intgrbenbro: Also beware that PostgreSQL may be restarted without warning if you have unattended upgrades enabled.14:59
benbroI don't think I allow automatic upgrades15:00
benbroshould I use "start on (local-filesystems and net-device-up IFACE!=lo)" if I'll just retry creating the connection to postgres?15:00
jodhbenbro: use "start on stopped rc" but you may have to poll as intgr suggests as you cannot guarantee that the db is servicing requests just because some process is running.15:05
benbrojodh: thanks15:05
axisyswhat is update-rc.d -f name remove equivalent for upstart process?23:43

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!