[15:17] *sigh* [15:17] I wish upstart's test suite wouldn't drop a core file [15:17] but I don't see any way of fixing that [15:20] (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:45] Keybuk: I think you pass a parameter to that one that tells you whether an arbitrary binary/input will halt [15:45] :D [15:47] I can find out that it generated a core file [15:47] since that's exactly what's being tested :p [15:47] which means this test case leaves a core file in the working directory [15:48] Inotify? [15:54] bah, [15:54] foiled by Ubuntu anyway [15:54] apport steals the core file and writes it itself [15:54] so it shows up after the test has completed [15:54] Heh [16:08] so, which config fields should undergo parameter expansion? [16:08] the obvious ones to me are: [16:08] "stop on" [16:08] "instance" [16:08] "uses" [16:09] "depends" [16:09] (where the last two are resources and file dependencies respectively) [16:10] exec and script obviously don't need to undergo parameter expansion since a shell is used, which will do it for us [16:10] "start on" can't, since it's matched for the config not the job [16:10] (and it would be nonsensical anyway) [16:11] "description", "author" and "version" don't seem to need it [16:11] "emits" probably doesn't (and isn't used by anything anyway) [16:12] "wait for", "respawn timer", "kill timer", "normal exit", "console", etc. are kinda tricky [16:12] "umask", "nice", "limit", "chroot", "chdir", etc. likewise [16:25] What kind of parameter expansion? [16:26] so, say you have this job [16:26] start on tty-added [16:26] stop on tty-removed $TTY [16:26] instance $TTY [16:26] respawn [16:26] exec /sbin/getty 38400 $TTY [16:26] -- [16:27] and the tty-added and tty-removed events have the TTY parameter set [16:27] that job can be started/stopped by things like: [16:27] start getty TTY=ttyS0 [16:27] stop getty TTY=ttyS0 [16:27] emit tty-added TTY=ttyS0 [16:27] emit tty-removed TTY=ttyS0 [16:27] the $TTY in the "stop on" is expanded at match time, against the $TTY variable stored in the job when it was started [16:28] (the variables in the job come from the start request, which is either explicit or the combination of the events) [16:29] I've also suggested there allowing the instance stanza to be expanded [16:29] this would provide the instance match [16:29] so you could have one instance of the getty job running for each unique value of the $TTY variable [16:29] if you did [16:29] start getty TTY=ttyS0 [16:29] start getty TTY=ttyS0 [16:29] the second one would fail with "already running" [16:30] (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:31] the question is, what other stanzas should undergo parameter expansion? [16:33] Right [16:36] Keybuk: can start on use parameter matching? i.e. start on hal.have_tty TTY==ttyS0 ? [16:37] sadmac_: yes [16:37] though it's just TTY=ttyS0 [16:37] cool. [16:37] (HAL is an entire WORLD of pain though) [16:38] do you know how difficult it would be to have an event or state to simply say, for any given HAL udi, "available"/"not available" ? :) === kylem_ is now known as kylem [16:39] "I'm sorry, Dave, but I'm afraid I can't do that" [16:42] something (and here's the problem already) would listen for org.freedesktop.Hal.Manager.DeviceAdded and DeviceRemoved signals [16:42] also NewCapability as well [16:42] those signals only contain the object ref, so are pretty useless [16:43] the something would then need to probe the device [16:43] so it needs to know in advance what kinds of devices it's actually looking for [16:43] as well as, for each device, listen for PropertyModified signals [17:38] ion_, sadmac: so, any comments? [17:39] Not yet. Too tired for the synapses to fire. :-) [17:39] Sounds good so far. [17:40] umask $UMASK [17:40] I don't think that kind of thing should be allowed [17:41] I can’t think of a use case for that. [17:43] aye, me neither [17:43] I think the same applies for everything process-setup wise [17:43] so console, umask, nice, limit, chroot & chdir shouldn't be expanded either [17:44] if you reeeeally want that, after all, you can just call things in the script [17:44] Indeed. [17:44] respawn related things like respawn timeout, kill timeout & normal exit don't make sense to me to be expanded [17:45] Ack [17:45] which pretty much just leaves the newer things [17:46] "stop on" definitely makes sense to match against the events found by "start on" [17:46] so no argument there [17:46] and I think using it for instance limiting makes sense too [17:46] "uses" is about locking, so there is actually a use-case for it [17:46] start on block-device-added [17:46] uses $DEVICE [17:47] would be a job that locked out any other job using $DEVICE [17:47] Is there a way to do something equivalent to /lib/udev/watershed’s functionality with ‘uses’ or something else? [17:47] something like that is an idea on the TODO list, yeah [17:48] the main difference between uses and watershed is that in the former, all jobs are queued [17:48] whereas with watershed, only one needs to be queued [17:48] Yep [17:49] Would be nice if watershed were in /bin, btw. :-) It’s useful outside udev as well. [17:53] * Keybuk is amused [17:53] an English sci-fi magazine (SFX) did a summary of Peter Petrelli's powers, [17:54] working out who they came from, and what other ones he might possess by inference [17:54] Heh [17:54] they 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 meantime [17:55] Yep :-) [17:55] then they worked out that Peter's met the Haitian, so he must have the power to stop Sylar's powers whenever they meet [17:55] (unless the Haitian's power inherently stopped Peter from absorbing it -- possible writer loophole) [17:55] Hehe [17:55] finally obviously Peter has met Hiro, and absorbed his powers [17:56] so all Peter needs to do is use Molly's powers (they met in S1 finale) to find everybody else [17:56] absorb all their powers [17:56] (quick and easy using teleportation) [17:56] and then go back in time, and meet himself [17:56] :-) [17:56] thereby giving his younger self all the powers of everybody [17:56] Heh [17:58] they suggested his might be unlikely, since it would give the writers a bit of a problem [18:00] There’s a big fuss about some guy scripting a wireframe 3D cube in Excel™ while we made a texturemapped raytraced tunnel in Excel™ four years ago . :-P [18:35] oops [18:35] it appears I've broken "respawn limit" [18:38] No problem, it’s just a matter of adding a sufficient amount of hardware. [18:39] (E.g. if whatever you execute forks and exits) [18:40] lol [18:40] Keybuk: the counterstrike fans will prefer it this way [18:40] the bug is that the instances get cleaned up now [18:41] so 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] it's also not immediately obvious to me whether a respawn limit is per job or per instance [18:42] e.g. dbus, it clearly doesn't matter since there can only be one [18:42] but getty, if you start 6 different gettys in quick succession, does that mean that the 6th fails to start? [18:42] or does it only apply should they attempt to respawn themselves? [18:42] Keybuk: the latter. It is a REspawn limit [18:42] Agreed. [18:43] but for a multi-instance job, you can start as many as you like very very quickly [18:43] should it apply to them? [18:43] *shrug* [18:43] Keybuk: no. If we need that functionality we need a separate feature for it [18:43] I guess that respawn limit is useful if it just catches a job that's runaway respawning] [18:43] ie. dying and resurrecting over and over again very quickly [18:43] "instance count" or such [18:44] in which case you actually don't want it to catch a restarting job [18:44] or new job [18:44] (manual restart, that is) [18:44] if you do; [18:44] while true; do stop --no-wait dbus; start --no-wait dbus; done [18:45] then I guess that technically *shouldn't* trigger the respawn limit, since the request is external [18:45] Yep. [18:45] The user requested it to do something stupid instead of there being a problem. :-) [18:45] You need it to keep the automated behavior from breaking things. If the admin breaks it its not upstart's business [18:46] what happens when respawn limit is hit? Does it retry after some time? [18:46] no, stops the job [18:46] yeah, makes sense. [18:47] * sadmac_ thinks about adding exponential backoff for jobs that contend on resources. [18:47] * sadmac_ hits himself with a stapler [18:47] Oh, i didn’t know you’re into that. [18:48] ion_: collision recovery? [18:48] selfstapling [18:49] ion_: yeah. office supplies make me feel like more of a man. [18:50] Keybuk: I've been thinking about a potential new stanza called "expect" Where you could specify a way to tell that the service is ready [18:50] Isn’t the post-start script sufficient? [18:51] ion_: not always. some services are dumb and there's no clean way to do it in bash. [18:52] sadmac_: what kind of thing would we put there? [18:52] 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:53] Keybuk: you can even (and this is scary) do a bit more ptrace magic. "expect syscall_listen" [18:55] pretty much like the "wait for" in trunk then? :) [18:55] wait for signal [18:55] wait for fork [18:55] wait for daemon [18:55] ah. [18:55] I'd planned to extend that to wait for a dbus name [18:55] the listen() is kinda cool, though I'm not sure how easy that would be to trap [18:56] Keybuk: wait for file would also be useful. rhgb is ready when a certain pts device appears. [18:56] wait for file /dev/pts/0 [18:57] what's different between wait for fork and wait for daemon? [18:58] one waits for a single fork() [18:59] the other waits for a double fork() [19:00] hm [19:02] Keybuk: how hard would it be to get arguments/environment variables persistent across respawns in 0.3.9? [19:02] Its becoming kind of a major issue [19:03] I really don't understand why that is an issue [19:03] sysvinit doesn't even *have* this [19:03] so if you're only trying to replace sysvinit, why are you using events at all? [19:03] 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:05] I'm still unclear what you're actually trying to do :-/ [19:06] Keybuk: we want upstart to run agetty every time a serial console becomes available [19:07] any serial console? [19:07] you run getty on all serial ports? [19:07] any serial console [19:07] Keybuk: there's a nearly infinite potential number [19:07] right [19:07] so you're using an instance job? [19:08] In effect I suppose [19:08] oh [19:08] that would be an issue. [19:08] you know you can only start one job once, right? :) [19:08] start getty [19:08] ... ok [19:08] start getty [19:08] ... already running [19:08] so you could only have one getty at a time with your job file anyway [19:09] start on fedora.serial-console-available * [19:09] [19:09] stop on runlevel [016] [19:09] respawn [19:09] exec /sbin/agetty /dev/$1 $2 vt100-nav [19:09] (stealing from your bugzilla) [19:09] won't work, since only one instance of that can run at a time [19:10] (the "*" is kinda unnecessary too, btw) [19:10] this I'm just realizing [19:10] want an ugly way to fix it? :) [19:10] start on fedora.serial-console-available [19:10] instance [19:10] stop on runlevel [016] [19:11] exec /sbin/agetty /dev/$1 $2 vt100-nav [19:11] post-stop exec initctl emit fedora.serial-console-available $1 $2 [19:11] * Keybuk grins [19:12] though that would respawn forever, ignoring the "stop on" bit [19:12] oh, instance jobs are in 0.3.9? [19:12] yeah [19:12] start on fedora.serial-console-available [19:12] I thought that was still trunk only [19:12] stop on runlevel [016] [19:12] instance [19:12] exec /sbin/agetty /dev/$1 $2 vt100-nav [19:12] pre-stop script [19:12] touch /tmp/ok-to-respawn-$1 [19:12] end script [19:13] post-stop script [19:13] [ -f /tmp/ok-to-respawn $1 ] || exit 0 [19:13] initctl emit fedora.serial-console-available $1 $2 [19:13] rm -f /tmp/ok-to-respawn [19:13] end script [19:13] (using the fact that pre-stop won't be run if the getty stops unnaturally) [19:15] and fix my obvious bugs of the ok-to-respawn filename :p [19:15] It needs to respawn in that case too. [19:16] ? [19:16] oh, I have the logic backwards [19:16] should be do-not-respawn :p [19:16] Its making sense now. [19:22] it's a hack, I know [19:22] but it will suffice [19:22] in trunk, the job would be somewhat simpler [19:22] Keybuk: do you want to post that to bugzilla or should I? [19:23] already done [19:23] cool [19:23] start on fedora.serial-console-available [19:23] stop on runlevel [016] or fedora.serial-console-gone $TTY [19:23] instance $TTY [19:23] respawn [19:23] exec /sbin/agetty /dev/$TTY $BAUD vt100-nav [19:23] -- [19:23] you might even stick [19:23] env BAUD=38400 [19:24] Keybuk: the big ugly in the 0.3.9 one is explicitly running /sbin/stop won't do anything [19:24] in there so you don't have to supply $BAUD to start if you don't want to [19:24] sadmac_: how do you mean? [19:24] Keybuk: never mind [19:24] running stop in a job script kinda hangs? :p [19:25] Keybuk: I was following the logic wrong [19:43] sadmac: http://gitweb.heh.fi/?p=ion/wait-for-file.git;a=blob;f=wait-for-file.c;hb=master [19:44] Interesting [19:45] ion_: I already have an inotifywait+bashism solution. [19:45] though this might be better [19:45] With a race condition. :-) [19:45] ion_: ah, you were there [19:45] 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:46] Hmm, I could build this in event-compat-sysv I suppose. [19:47] (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] cool :) [19:47] ion_: thanks [19:47] np [19:48] ion_: is there a git:// url for this? [19:50] http://gitweb.heh.fi/?p=ion/wait-for-file.git shows it: git://heh.fi/ion/wait-for-file.git [19:51] cool [21:30] http://bazaar.launchpad.net/~keybuk/upstart/trunk/revision/scott%40netsplit.com-20080307213253-zd7x3w606y947zoj?start_revid=scott%40netsplit.com-20080307213253-zd7x3w606y947zoj [21:30] \o/ [21:31] \o\ [21:32] o o o o o o> o [21:32] .|. \|. \|/ // X \ | <| <|> [21:32] /\ >\ /< >\ /< >\ /< >\ /< [21:32] ^ ^ [21:32] [21:32] _ [21:39] pimp === sadmac__ is now known as sadmac [21:42] (^-_-^) <( -_-<) (>-_- )> (V-_-v) [21:42] Did you know that your nick reversed is cadmas? [21:42] ion_: actually its camdas [21:42] No, i reject that. [21:43] ion_: kernel panic - not syncing: total ordering property assertion failed [21:44] * ion_ considers going to maintenance mode. [21:45] ion_: you can only fix code problems and configuration problems that way. It doesn't help you when math is broken. [21:49] Keybuk: so what else is outstanding? [21:50] Bug #1 for one. [21:52] sadmac: still a few bits for an 0.5.0 [21:52] name-limited instances [21:52] and obviously D-BUS, which will involve rewriting initctl [21:52] other 0.5 bits can then come after the release [21:53] Keybuk: what's with name-limited instances? [21:53] so at the moment, there are two possibilities [21:53] a job may only have one instance (the default) [21:53] if you attempt to start when already started, you'll just get an error [21:53] OR [21:53] a job may have unlimited instances ("instance") [21:53] if you attempt to start, you'll always get another job [21:53] I want to add a third [21:54] a job may have a limited number of instances, each identified by a unique name [21:54] ("instance $TTY") [21:54] ahh [21:54] if you attempt to start, it may start a new job OR fail because it's already started, depending on the value of $TTY you give [21:54] that means, for example, that if you have a job like: [21:55] start on tty-added [21:55] stop on tty-removed $TTY [21:55] instance $TTY [21:55] and you very quickly do [21:55] initctl emit --no-wait tty-added TTY=ttyS0 [21:55] initctl emit --no-wait tty-removed TTY=ttyS0 [21:55] initctl emit --no-wait tty-added TTY=ttyS0 [21:55] that will cause the *existing* instance to be restarted, rather than spawn a new one [21:55] ha [21:56] so for tomcat, say.... [21:56] the tomcat instances might be named after the apps they are running [21:56] right [21:57] it's also the basis for an interesting way to permit multiple instances of things like apache [21:57] instance $CONFFILE [21:57] hm [21:57] exec apache2 -f $CONFFILE [21:57] for example [21:57] 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:58] that'd let you start as many instances as apache2 as you had conffiles [21:58] ion_: only until we have file eventts [21:58] Ah, right. They’ll be a nice solution to that. [21:59] Keybuk: this is really important for the user session case [21:59] instance $SOMESESSIONUNIQUEPROPERTY [22:00] yeah, you can be quite arbitrary [22:00] instance $USER-$TTY-$BAUD-$FOO [22:00] etc. [22:00] that's why I decided to just expand environment there [22:00] instance ${TTY:-notatty} [22:00] Nice [22:00] * Keybuk had fun writing that [22:01] Keybuk: you're going to want to talk about this to the PolicyKit folk [22:01] If by "the PolicyKit folk", you mean davidz? ... :) [22:01] No, he’s now DavidKit. [22:02] ion_: I still have the original david, its not kit built [22:02] sadmac: I talk to david a fair amount [22:02] Keybuk: ah, cool [22:02] I'd imagine it will get interesting once we need policies around starting and stopping jobs for per-session tasks [22:04] DBus will probably give us a lot of that for cheap though. [22:04] the trouble with Upstart is a tendancy for people to try and fix all their problems at once with it [22:04] including myself [22:04] Keybuk: 0.5 will be able to simonize my car, right? [22:04] user sessions are easy in Upstart, since a user session is just a collection of environment variables to set [22:04] "simonize" ? [22:05] Its a fancy waxing job that I could be misspelling [22:05] dict(1) knows simonize. :-) [22:05] well, obviously misspelling since it should be "simonise" ;) [22:05] :-D [22:05] * sadmac just got britished [22:05] Britised, you mean. [22:05] not our fault you guys aren't keeping up with the updates to the language you're using ;) [22:06] * sadmac git pull english [22:06] (actually -ize vs. -ise is a long standing division between the major two British dictionary presses, but I digress) [22:07] I 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:10] In which dialect do you pronounce pronunciation pronounciation? :-) [22:11] ion_: good question [22:14] pronounciation (n): The act of making something into a pronoun. [22:16] In Finnish, pronoun is pronomini, but noun is substantiivi. [22:20] hm [22:20] prosubstantiivi [22:20] ^^If that's edible, I want some. [22:22] No, but you can take it intravenously. [22:22] what's it do [22:22] ? [22:25] 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:26] Is Julia Child there? [22:27] You’ll have to ask her. [22:29] * sadmac expands his mind [23:18] http://bazaar.launchpad.net/~keybuk/upstart/trunk/revision/scott%40netsplit.com-20080307232034-k4dlc4humlxubprd?start_revid=scott%40netsplit.com-20080307232050-9u2sj8ld588t441q [23:19] ^ name-limited-instance support [23:23] Keybuk: so that leaves DBus.