/srv/irclogs.ubuntu.com/2008/03/07/#upstart.txt

Keybuk*sigh*15:17
KeybukI wish upstart's test suite wouldn't drop a core file15:17
Keybukbut I don't see any way of fixing that15:17
Keybuk(unless anyone knows a syscall that you can invoke on a child process to find out the name of the core file it generated? :p)15:20
sadmac_Keybuk: I think you pass a parameter to that one that tells you whether an arbitrary binary/input will halt15:45
sadmac_:D15:45
KeybukI can find out that it generated a core file15:47
Keybuksince that's exactly what's being tested :p15:47
Keybukwhich means this test case leaves a core file in the working directory15:47
sadmac_Inotify?15:48
Keybukbah,15:54
Keybukfoiled by Ubuntu anyway15:54
Keybukapport steals the core file and writes it itself15:54
Keybukso it shows up after the test has completed15:54
ion_Heh15:54
Keybukso, which config fields should undergo parameter expansion?16:08
Keybukthe obvious ones to me are:16:08
Keybuk  "stop on"16:08
Keybuk  "instance"16:08
Keybuk  "uses"16:08
Keybuk  "depends"16:09
Keybuk(where the last two are resources and file dependencies respectively)16:09
Keybukexec and script obviously don't need to undergo parameter expansion since a shell is used, which will do it for us16:10
Keybuk"start on" can't, since it's matched for the config not the job16:10
Keybuk(and it would be nonsensical anyway)16:10
Keybuk"description", "author" and "version" don't seem to need it16:11
Keybuk"emits" probably doesn't (and isn't used by anything anyway)16:11
Keybuk"wait for", "respawn timer", "kill timer", "normal exit", "console", etc. are kinda tricky16:12
Keybuk"umask", "nice", "limit", "chroot", "chdir", etc. likewise16:12
ion_What kind of parameter expansion?16:25
Keybukso, say you have this job16:26
Keybuk  start on tty-added16:26
Keybuk  stop on tty-removed $TTY16:26
Keybuk  instance $TTY16:26
Keybuk  respawn16:26
Keybuk  exec /sbin/getty 38400 $TTY16:26
Keybuk-- 16:26
Keybukand the tty-added and tty-removed events have the TTY parameter set16:27
Keybukthat job can be started/stopped by things like:16:27
Keybuk  start getty TTY=ttyS016:27
Keybuk  stop getty TTY=ttyS016:27
Keybuk  emit tty-added TTY=ttyS016:27
Keybuk  emit tty-removed TTY=ttyS016:27
Keybukthe $TTY in the "stop on" is expanded at match time, against the $TTY variable stored in the job when it was started16:27
Keybuk(the variables in the job come from the start request, which is either explicit or the combination of the events)16:28
KeybukI've also suggested there allowing the instance stanza to be expanded16:29
Keybukthis would provide the instance match16:29
Keybukso you could have one instance of the getty job running for each unique value of the $TTY variable16:29
Keybukif you did16:29
Keybuk  start getty TTY=ttyS016:29
Keybuk  start getty TTY=ttyS016:29
Keybukthe second one would fail with "already running"16:29
Keybuk(the $TTY in the exec is actually *NOT* undergoing upstart parameter expansion, the entire exec string is passed to a shell, so /bin/sh expands that with the environment)16:30
Keybukthe question is, what other stanzas should undergo parameter expansion?16:31
ion_Right16:33
sadmac_Keybuk: can start on use parameter matching? i.e. start on hal.have_tty TTY==ttyS0 ?16:36
Keybuksadmac_: yes16:37
Keybukthough it's just TTY=ttyS016:37
sadmac_cool.16:37
Keybuk(HAL is an entire WORLD of pain though)16:37
Keybukdo you know how difficult it would be to have an event or state to simply say, for any given HAL udi, "available"/"not available" ? :)16:38
=== kylem_ is now known as kylem
sadmac_"I'm sorry, Dave, but I'm afraid I can't do that"16:39
Keybuksomething (and here's the problem already) would listen for org.freedesktop.Hal.Manager.DeviceAdded and DeviceRemoved signals16:42
Keybukalso NewCapability as well16:42
Keybukthose signals only contain the object ref, so are pretty useless16:42
Keybukthe something would then need to probe the device16:43
Keybukso it needs to know in advance what kinds of devices it's actually looking for16:43
Keybukas well as, for each device, listen for PropertyModified signals16:43
Keybukion_, sadmac: so, any comments?17:38
ion_Not yet. Too tired for the synapses to fire. :-)17:39
ion_Sounds good so far.17:39
Keybuk  umask $UMASK17:40
KeybukI don't think that kind of thing should be allowed17:40
ion_I can’t think of a use case for that.17:41
Keybukaye, me neither17:43
KeybukI think the same applies for everything process-setup wise17:43
Keybukso console, umask, nice, limit, chroot & chdir shouldn't be expanded either17:43
Keybukif you reeeeally want that, after all, you can just call things in the script17:44
ion_Indeed.17:44
Keybukrespawn related things like respawn timeout, kill timeout & normal exit don't make sense to me to be expanded17:44
ion_Ack17:45
Keybukwhich pretty much just leaves the newer things17:45
Keybuk"stop on" definitely makes sense to match against the events found by "start on"17:46
Keybukso no argument there17:46
Keybukand I think using it for instance limiting makes sense too17:46
Keybuk"uses" is about locking, so there is actually a use-case for it17:46
Keybuk  start on block-device-added17:46
Keybuk  uses $DEVICE17:46
Keybukwould be a job that locked out any other job using $DEVICE17:47
ion_Is there a way to do something equivalent to /lib/udev/watershed’s functionality with ‘uses’ or something else?17:47
Keybuksomething like that is an idea on the TODO list, yeah17:47
Keybukthe main difference between uses and watershed is that in the former, all jobs are queued17:48
Keybukwhereas with watershed, only one needs to be queued17:48
ion_Yep17:48
ion_Would be nice if watershed were in /bin, btw. :-) It’s useful outside udev as well.17:49
* Keybuk is amused17:53
Keybukan English sci-fi magazine (SFX) did a summary of Peter Petrelli's powers,17:53
Keybukworking out who they came from, and what other ones he might possess by inference17:54
ion_Heh17:54
Keybukthey first of all worked out that since his absorption appears instant, he will always have the upper hand on Sylar since the minute they meet, Peter will also have whatever other powers he's gained in the meantime17:54
ion_Yep :-)17:55
Keybukthen they worked out that Peter's met the Haitian, so he must have the power to stop Sylar's powers whenever they meet17:55
Keybuk(unless the Haitian's power inherently stopped Peter from absorbing it -- possible writer loophole)17:55
ion_Hehe17:55
Keybukfinally obviously Peter has met Hiro, and absorbed his powers17:55
Keybukso all Peter needs to do is use Molly's powers (they met in S1 finale) to find everybody else17:56
Keybukabsorb all their powers17:56
Keybuk(quick and easy using teleportation)17:56
Keybukand then go back in time, and meet himself17:56
ion_:-)17:56
Keybukthereby giving his younger self all the powers of everybody17:56
ion_Heh17:56
Keybukthey suggested his might be unlikely, since it would give the writers a bit of a problem17:58
ion_There’s a big fuss about some guy scripting a wireframe 3D cube in Excel™ <http://youtube.com/watch?v=vypETZbkU94> while we made a texturemapped raytraced tunnel in Excel™ four years ago <http://youtube.com/watch?v=_whSnPErl7c>. :-P18:00
Keybukoops18:35
Keybukit appears I've broken "respawn limit"18:35
ion_No problem, it’s just a matter of adding a sufficient amount of hardware.18:38
ion_(E.g. if whatever you execute forks and exits)18:39
Keybuklol18:40
sadmac_Keybuk: the counterstrike fans will prefer it this way18:40
Keybukthe bug is that the instances get cleaned up now18:40
Keybukso if you stop; sleep 5; start ... the start won't be subject to any limit since the stop would have freed the struct that contains the count of how many times the instance has actually been started or stopped recently :)18:41
Keybukit's also not immediately obvious to me whether a respawn limit is per job or per instance18:41
Keybuke.g. dbus, it clearly doesn't matter since there can only be one18:42
Keybukbut getty, if you start 6 different gettys in quick succession, does that mean that the 6th fails to start?18:42
Keybukor does it only apply should they attempt to respawn themselves?18:42
sadmac_Keybuk: the latter. It is a REspawn limit18:42
ion_Agreed.18:42
Keybukbut for a multi-instance job, you can start as many as you like very very quickly18:43
Keybukshould it apply to them?18:43
Keybuk*shrug*18:43
sadmac_Keybuk: no. If we need that functionality we need a separate feature for it18:43
KeybukI guess that respawn limit is useful if it just catches a job that's runaway respawning]18:43
Keybukie. dying and resurrecting over and over again very quickly18:43
sadmac_"instance count" or such18:43
Keybukin which case you actually don't want it to catch a restarting job18:44
Keybukor new job18:44
Keybuk(manual restart, that is)18:44
Keybukif you do;18:44
Keybukwhile true; do stop --no-wait dbus; start --no-wait dbus; done18:44
Keybukthen I guess that technically *shouldn't* trigger the respawn limit, since the request is external18:45
ion_Yep.18:45
ion_The user requested it to do something stupid instead of there being a problem. :-)18:45
sadmac_You need it to keep the automated behavior from breaking things. If the admin breaks it its not upstart's business18:45
sadmac_what happens when respawn limit is hit? Does it retry after some time?18:46
Keybukno, stops the job18:46
sadmac_yeah, makes sense.18:46
* sadmac_ thinks about adding exponential backoff for jobs that contend on resources.18:47
* sadmac_ hits himself with a stapler18:47
ion_Oh, i didn’t know you’re into that.18:47
sadmac_ion_: collision recovery?18:48
ion_selfstapling18:48
sadmac_ion_: yeah. office supplies make me feel like more of a man.18:49
sadmac_Keybuk: I've been thinking about a potential new stanza called "expect" Where you could specify a way to tell that the service is ready18:50
ion_Isn’t the post-start script sufficient?18:50
sadmac_ion_: not always. some services are dumb and there's no clean way to do it in bash.18:51
Keybuksadmac_: what kind of thing would we put there?18:52
sadmac_Keybuk: "expect sigstop" for services that will stop themselves when prepped, "expect file /path" for services that are ready when a file appears (presumably a named pipe or unix domain socket)18:52
sadmac_Keybuk: you can even (and this is scary) do a bit more ptrace magic. "expect syscall_listen"18:53
Keybukpretty much like the "wait for" in trunk then? :)18:55
Keybukwait for signal18:55
Keybukwait for fork18:55
Keybukwait for daemon18:55
sadmac_ah.18:55
KeybukI'd planned to extend that to wait for a dbus name18:55
Keybukthe listen() is kinda cool, though I'm not sure how easy that would be to trap18:55
sadmac_Keybuk: wait for file would also be useful. rhgb is ready when a certain pts device appears.18:56
sadmac_wait for file /dev/pts/018:56
sadmac_what's different between wait for fork and wait for daemon?18:57
Keybukone waits for a single fork()18:58
Keybukthe other waits for a double fork()18:59
sadmac_hm19:00
sadmac_Keybuk: how hard would it be to get arguments/environment variables persistent across respawns in 0.3.9?19:02
sadmac_Its becoming kind of a major issue19:02
KeybukI really don't understand why that is an issue19:03
Keybuksysvinit doesn't even *have* this19:03
Keybukso if you're only trying to replace sysvinit, why are you using events at all?19:03
sadmac_Because we had something really ugly that's going to be easier to do the right way than it is to rebuild in upstart.19:03
KeybukI'm still unclear what you're actually trying to do :-/19:05
sadmac_Keybuk: we want upstart to run agetty every time a serial console becomes available19:06
Keybukany serial console?19:07
Keybukyou run getty on all serial ports?19:07
sadmac_any serial console19:07
sadmac_Keybuk: there's a nearly infinite potential number19:07
Keybukright19:07
Keybukso you're using an instance job?19:07
sadmac_In effect I suppose19:08
sadmac_oh19:08
sadmac_that would be an issue.19:08
Keybukyou know you can only start one job once, right? :)19:08
Keybukstart getty19:08
Keybuk... ok19:08
Keybukstart getty19:08
Keybuk... already running19:08
Keybukso you could only have one getty at a time with your job file anyway19:08
Keybukstart on fedora.serial-console-available *19:09
Keybuk 19:09
Keybukstop on runlevel [016]19:09
Keybukrespawn19:09
Keybukexec /sbin/agetty /dev/$1 $2 vt100-nav19:09
Keybuk(stealing from your bugzilla)19:09
Keybukwon't work, since only one instance of that can run at a time19:09
Keybuk(the "*" is kinda unnecessary too, btw)19:10
sadmac_this I'm just realizing19:10
Keybukwant an ugly way to fix it? :)19:10
Keybuk    start on fedora.serial-console-available19:10
Keybuk    instance19:10
Keybuk    stop on runlevel [016]19:10
Keybuk    exec /sbin/agetty /dev/$1 $2 vt100-nav19:11
Keybuk    post-stop exec initctl emit fedora.serial-console-available $1 $219:11
* Keybuk grins19:11
Keybukthough that would respawn forever, ignoring the "stop on" bit19:12
sadmac_oh, instance jobs are in 0.3.9?19:12
Keybukyeah19:12
Keybuk    start on fedora.serial-console-available19:12
sadmac_I thought that was still trunk only19:12
Keybuk    stop on runlevel [016]19:12
Keybuk    instance19:12
Keybuk    exec /sbin/agetty /dev/$1 $2 vt100-nav19:12
Keybuk    pre-stop script19:12
Keybuk        touch /tmp/ok-to-respawn-$119:12
Keybuk    end script19:12
Keybuk    post-stop script19:13
Keybuk        [ -f /tmp/ok-to-respawn $1 ] || exit 019:13
Keybuk        initctl emit fedora.serial-console-available $1 $219:13
Keybuk        rm -f /tmp/ok-to-respawn19:13
Keybuk    end script19:13
Keybuk(using the fact that pre-stop won't be run if the getty stops unnaturally)19:13
Keybukand fix my obvious bugs of the ok-to-respawn filename :p19:15
sadmac_It needs to respawn in that case too.19:15
Keybuk?19:16
Keybukoh, I have the logic backwards19:16
Keybukshould be do-not-respawn :p19:16
sadmac_Its making sense now.19:16
Keybukit's a hack, I know19:22
Keybukbut it will suffice19:22
Keybukin trunk, the job would be somewhat simpler19:22
sadmac_Keybuk: do you want to post that to bugzilla or should I?19:22
Keybukalready done19:23
sadmac_cool19:23
Keybuk    start on fedora.serial-console-available19:23
Keybuk    stop on runlevel [016] or fedora.serial-console-gone $TTY19:23
Keybuk    instance $TTY19:23
Keybuk    respawn19:23
Keybuk    exec /sbin/agetty /dev/$TTY $BAUD vt100-nav19:23
Keybuk-- 19:23
Keybukyou might even stick19:23
Keybuk    env BAUD=3840019:23
sadmac_Keybuk: the big ugly in the 0.3.9 one is explicitly running /sbin/stop won't do anything19:24
Keybukin there so you don't have to supply $BAUD to start if you don't want to19:24
Keybuksadmac_: how do you mean?19:24
sadmac_Keybuk: never mind19:24
Keybukrunning stop in a job script kinda hangs? :p19:24
sadmac_Keybuk: I was following the logic wrong19:25
ion_sadmac: http://gitweb.heh.fi/?p=ion/wait-for-file.git;a=blob;f=wait-for-file.c;hb=master19:43
sadmac_Interesting19:44
sadmac_ion_: I already have an inotifywait+bashism solution.19:45
sadmac_though this might be better19:45
ion_With a race condition. :-)19:45
sadmac_ion_: ah, you were there19:45
ion_I specifically open the inotify watch first, then check whether the file exists and decide whether to begin waiting for the appropriate inotify event.19:45
sadmac_Hmm, I could build this in event-compat-sysv I suppose.19:46
ion_(I’m tired, there may very well be something wrong with the code. I did some quick testing and valgrinding and it seems to work.)19:47
sadmac_cool :)19:47
sadmac_ion_: thanks19:47
ion_np19:47
sadmac_ion_: is there a git:// url for this?19:48
ion_http://gitweb.heh.fi/?p=ion/wait-for-file.git shows it: git://heh.fi/ion/wait-for-file.git19:50
sadmac_cool19:51
Keybukhttp://bazaar.launchpad.net/~keybuk/upstart/trunk/revision/scott%40netsplit.com-20080307213253-zd7x3w606y947zoj?start_revid=scott%40netsplit.com-20080307213253-zd7x3w606y947zoj21:30
Keybuk\o/21:30
ion_\o\21:31
Keybuk    o      o     o    o     o    <o     <o>    o>    o21:32
Keybuk   .|.    \|.   \|/   //    X     \      |    <|    <|>21:32
Keybuk    /\     >\   /<    >\   /<     >\    /<     >\   /<21:32
ion_^     ^21:32
ion_ 21:32
ion_   _21:32
sadmac__pimp21:39
=== sadmac__ is now known as sadmac
sadmac(^-_-^)  <( -_-<) (>-_- )> (V-_-v)21:42
ion_Did you know that your nick reversed is cadmas?21:42
sadmacion_: actually its camdas21:42
ion_No, i reject that.21:42
sadmacion_: kernel panic - not syncing: total ordering property assertion failed21:43
* ion_ considers going to maintenance mode.21:44
sadmacion_: you can only fix code problems and configuration problems that way. It doesn't help you when math is broken.21:45
sadmacKeybuk: so what else is outstanding?21:49
ion_Bug #1 for one.21:50
Keybuksadmac: still a few bits for an 0.5.021:52
Keybukname-limited instances21:52
Keybukand obviously D-BUS, which will involve rewriting initctl21:52
Keybukother 0.5 bits can then come after the release21:52
sadmacKeybuk: what's with name-limited instances?21:53
Keybukso at the moment, there are two possibilities21:53
Keybuka job may only have one instance (the default)21:53
Keybukif you attempt to start when already started, you'll just get an error21:53
KeybukOR21:53
Keybuka job may have unlimited instances ("instance")21:53
Keybukif you attempt to start, you'll always get another job21:53
KeybukI want to add a third21:53
Keybuka job may have a limited number of instances, each identified by a unique name21:54
Keybuk("instance $TTY")21:54
sadmacahh21:54
Keybukif you attempt to start, it may start a new job OR fail because it's already started, depending on the value of $TTY you give21:54
Keybukthat means, for example, that if you have a job like:21:54
Keybuk  start on tty-added21:55
Keybuk  stop on tty-removed $TTY21:55
Keybuk  instance $TTY21:55
Keybukand you very quickly do21:55
Keybuk  initctl emit --no-wait tty-added TTY=ttyS021:55
Keybuk  initctl emit --no-wait tty-removed TTY=ttyS021:55
Keybuk  initctl emit --no-wait tty-added TTY=ttyS021:55
Keybukthat will cause the *existing* instance to be restarted, rather than spawn a new one21:55
sadmacha21:55
sadmacso for tomcat, say....21:56
sadmacthe tomcat instances might be named after the apps they are running21:56
Keybukright21:56
Keybukit's also the basis for an interesting way to permit multiple instances of things like apache21:57
Keybuk  instance $CONFFILE21:57
sadmachm21:57
Keybuk  exec apache2 -f $CONFFILE21:57
Keybukfor example21:57
ion_If i want to start such instances automatically on startup based on a list of apps in /etc/something, would i need another job to start those ones?21:57
Keybukthat'd let you start as many instances as apache2 as you had conffiles21:58
Keybukion_: only until we have file eventts21:58
ion_Ah, right. They’ll be a nice solution to that.21:58
sadmacKeybuk: this is really important for the user session case21:59
sadmacinstance $SOMESESSIONUNIQUEPROPERTY21:59
Keybukyeah, you can be quite arbitrary22:00
Keybukinstance $USER-$TTY-$BAUD-$FOO22:00
Keybuketc.22:00
Keybukthat's why I decided to just expand environment there22:00
Keybukinstance ${TTY:-notatty}22:00
ion_Nice22:00
* Keybuk had fun writing that22:00
sadmacKeybuk: you're going to want to talk about this to the PolicyKit folk22:01
KeybukIf by "the PolicyKit folk", you mean davidz? ... :)22:01
ion_No, he’s now DavidKit.22:01
sadmacion_: I still have the original david, its not kit built22:02
Keybuksadmac: I talk to david a fair amount22:02
sadmacKeybuk: ah, cool22:02
sadmacI'd imagine it will get interesting once we need policies around starting and stopping jobs for per-session tasks22:02
sadmacDBus will probably give us a lot of that for cheap though.22:04
Keybukthe trouble with Upstart is a tendancy for people to try and fix all their problems at once with it22:04
Keybukincluding myself22:04
sadmacKeybuk: 0.5 will be able to simonize my car, right?22:04
Keybukuser sessions are easy in Upstart, since a user session is just a collection of environment variables to set22:04
Keybuk"simonize" ?22:04
sadmacIts a fancy waxing job that I could be misspelling22:05
ion_dict(1) knows simonize. :-)22:05
Keybukwell, obviously misspelling since it should be "simonise" ;)22:05
ion_:-D22:05
* sadmac just got britished22:05
ion_Britised, you mean.22:05
Keybuknot our fault you guys aren't keeping up with the updates to the language you're using ;)22:05
* sadmac git pull english22:06
Keybuk(actually -ize vs. -ise is a long standing division between the major two British dictionary presses, but I digress)22:06
sadmacI was really surprised when I found out you guys had an extra vowel in "Alumin[i]um." I just thought it was creative pronounciation.22:07
ion_In which dialect do you pronounce pronunciation pronounciation? :-)22:10
sadmacion_: good question22:11
sadmacpronounciation (n): The act of making something into a pronoun.22:14
ion_In Finnish, pronoun is pronomini, but noun is substantiivi.22:16
sadmachm22:20
sadmacprosubstantiivi22:20
sadmac^^If that's edible, I want some.22:20
ion_No, but you can take it intravenously.22:22
sadmacwhat's it do22:22
sadmac?22:22
ion_It puts your mind to a state where you experience being on IRC, usually on #upstart@Freenode, and you have very vivid hallucinations about other people talking with you online.22:25
sadmacIs Julia Child there?22:26
ion_You’ll have to ask her.22:27
* sadmac expands his mind22:29
Keybukhttp://bazaar.launchpad.net/~keybuk/upstart/trunk/revision/scott%40netsplit.com-20080307232034-k4dlc4humlxubprd?start_revid=scott%40netsplit.com-20080307232050-9u2sj8ld588t441q23:18
Keybuk^ name-limited-instance support23:19
sadmacKeybuk: so that leaves DBus.23:23

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