/srv/irclogs.ubuntu.com/2010/09/30/#upstart.txt

coshxi'm debugging an upstart conf, but "sudo start myjob" and "sudo stop myjob" are freezing. I can ctrl+c out, but to get back to normal behavior, I have to reboot. the only change in /var/log is to auth.log (because of sudo). strace shows it freezing at "poll([{fd=3, events=POLLIN}], 1, -1", but I'm not sure what this means.02:27
coshxI'm guessing that fd is from connect(3, {sa_family=AF_FILE, path=@"/com/ubuntu/upstart"}, 22) = 0 -- is that a dbus socket?02:45
ionPlease pastebin the config.02:50
coshxion: http://gist.github.com/603892 <-- this is what I had (for debugging). It worked as expected a couple times, but then when I called "sudo stop cruise" it froze. I was debugging by calling initctl reload-configuration and then start/stop02:52
ionYour program most likely doesn’t behave as “expect daemon” expects and the current version of Upstart gets confused.02:53
ionAh, it’s an sh script. Yeah, every external command ran by it consists of a fork and an exec, and Upstart follows the first fork and waits for the second one.02:54
ionBetter drop the “expect” stanza if you don’t know *precisely* how the main program behaves regarding forks.02:54
ionUpstart 0.10 will handle forking programs much better.02:54
coshxinteresting. the actual process should daemonize, but I'll remove the expect and see if I get the behavior I want02:55
coshxafter removing that line, start/stop still freeze -- i'm guessing I have to restart the init process?02:57
coshx(the only way I know how to do that is to restart)02:57
ionYeah, the job is a confused state, expecting for the first command ran by the sh script to finish daemonizing. If rebooting isn’t a problem, that’s the fastest way to get Upstart to a good state.02:59
ionThe fork-following code is a simple initial implementation that only supports two specific use cases (which don’t include most sh scripts), and as i said, a much better replacement is in the works.03:04
coshxnice, i just don't daemonize the process and don't use 'expect' and it works perfectly! :)  Thanks for explaining to me03:07
coshxthanks! btw, when I do console output, should I be able to cat /dev/console and see output of the command? I assume this wouldn't show output from a fork though, right?03:24
ionIt might be best to log to a file and read that.03:29
ionIn a future release, the console stanza will support logging.03:29
ionThe simplest style:03:30
ionscript03:30
ion  exec >/path/to/log 2>&103:30
ion  (the rest)03:30
ionend script03:30
coshxoh nice. i saw that on the wiki, but didn't realize it directs all output for the script to the logfile.03:35
anymoushello, how can i stop an upstart job that is defined as "task"?  the command "stop job" gives: stop: Unknown instance: under Lucid.13:06
ionAre you sure it’s running?13:09
anymousI think the problem with "tasks" is that they are listed as "stop/waiting"13:09
anymousalthough they have been running (doing their "task").13:10
ionThat’s the point of tasks.13:11
anymousthis is true for all jobs marked as tasks, like rcS, rc, mountall-shell, ...13:11
anymousbut some of them have a "pre-stop" section 13:11
ionPlease see init(5), look up the definition of task under “Services, tasks and respawning”.13:11
anymousI have read the manpage, but it doesn't answer the question how can you invoke initclt so that the pre-stop section is executed.13:12
ionIf the job has stopped successfully, the pre-stop part has been executed.13:14
anymousok, just do "stop rcS" it does nothing but print "stop: Unknown instance:"13:14
ionYes, it’s not running.13:14
anymousarg, so the post-script is never executed and thus quite superfluous, no?13:14
anymousIOW you cannot have a task that defines a stop action.13:15
ionThe post-stop script has been executed when job stopped.13:15
anymousi don't think so13:16
ionIf you’re sure about that, please file a bug report. But i’m somewhat skeptical, since the unit tests should have caught that long before such a bug ever made it into the Ubuntu archive.13:16
ionNot to mention that such a bug would probably result in a non-booting system.13:17
anymoushm, so how can i invoke the stop action of a task manually?13:17
ionYou don’t really do that directly. You can only tell running tasks to stop, which results in the {pre,post}-stop scripts being executed.13:18
anymousbut only if the status is running.13:18
ionSure. How would one stop something that is not running?13:18
anymousright, you said that.13:18
anymousok, my example: 13:19
anymousI have an upstart script that mounts a special directory13:19
anymousit seems i cannot use stop(8) to invoke the stop action of that job13:20
anymousbecause the status after boot of that job is stop/waiting13:20
anymousalthough of course the directory is mounted13:20
ionfoo.conf:13:20
ionpre-start exec mount /foo13:21
ionpost-stop exec umount /foo13:21
ionNo task13:21
anymousah! no task, alright, i think i have to try that.13:21
anymouswould it work with  script sections, (script, pre-stop)?13:22
ionTask means you want everything to run when started, including the {pre,post}-stop scripts at the end.13:22
ionpre-start script … end script, post-stop script … end script13:22
anymousthanks for pointing that out, will try it.13:23
ionService means your job goes to a certain state (such as directory mounted or daemon running) when started and only does any stop actions when something external causes it to stop.13:24
anymousdoes a service not always require a daemon, a running process?13:26
ionIt’s optional13:26
anymousok, give me a few reboots...13:27
anymousno joy, i removed the "task" but still cannot invoke the stop action13:41
ionWhat does “status jobname” print? What appears in syslog when you run “start jobname”?13:43
anymousstatus: stop/waiting, start gives: start/running, process 207913:44
mbieblanymous: please pastebin your current job file13:45
anymousnot familiar with pastebin :-(13:45
ionThere probably should be no process ID if there’s no main process.13:46
ionAnd there shouldn’t be a main process in your job.13:46
anymousright, theres no process running after the mount13:46
anymousbut i think it's similair to rcS, you can't run "stop rcS"13:47
ionNo, more like apport13:47
mbieblhttp://lmgtfy.com/?q=pastebin13:48
anymousok, when I do "stop apport" it also gives: stop: Unknown instance:13:48
anymousmmbiebl: thanks ;)13:49
ionThat’s because you have apport disabled. The structure of the job should be similar nevertheless.13:49
anymoushttp://pastebin.com/ZfP8mSAu13:51
ionReplace ‘script’ with ‘pre-start script’13:52
ionYou don’t want a main process for that job.13:52
ionAlso, there’s a space between ‘runlevel’ and its parameter.13:53
* anymous is correcting13:54
anymoushttp://pastebin.com/nxQcu7Vh but still ... status: stop/waiting14:05
anymouswhen you enable apport, its status is running after boot?14:06
ionYes14:07
anymouswithout a process?14:07
ionYes14:08
anymousthanks for you patience, somehow the status of my job (stop/waiting) is wrong after boot, but i've found a workaround for that.15:02
BLZbubbai like the verbose boot option; but is there a way to have upstart log to a file?  /var/log or /tmp or whatever?17:57
BLZbubbai am using a console-less machine and it fails to start everything17:57
BLZbubbaafter awhile i can start the network by hand and run "init 2"17:58
BLZbubbabut this is not ideal17:58
rawlerhas "initctl events" been remove to trace upstart events?18:09
rawlerergmh, sprinkle the last statement with some grammar, please..18:09
BLZbubbaheh18:42
mbieblBLZbubba: w/r/t logging, no there is not18:45
indygregis there any workaround for the non-valid PID stuck in the killed state? I think it is bug #406397. i.e. I want to force mark a job as stopped/having no PID21:36

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