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

sadmacKeybuk: are you here?05:03
Keybuksadmac: hi09:10
Keybukion_: did you get a chance to read through http://upstart.ubuntu.com/wiki/JobAtomicity ?11:29
ion_Thanks for pointing it out, will read.11:34
sadmac_Keybuk: initctl start isn't behaving like it should15:36
sadmac_It blocks until the job is stopped again, rather than until its started.15:40
Keybukdid you declare the job as a service?15:41
sadmac_Keybuk: ...I'm guessing not. What's needed to do that?15:41
Keybuk"service"15:42
Keybukor "respawn"15:42
sadmac_ahh.15:42
Keybukthere's some debate there about which is the right default15:44
* sadmac_ needs a kvm with network support15:49
sadmac_hard to test upstart through ssh15:49
Keybukheh16:10
sadmac_Keybuk: if a pre-start script returns nonzero, does the job not run?16:18
Keybukright16:19
Keybukthe job will fail16:19
sadmac_perfect16:19
Keybukall scripts are run with -e too16:20
sadmac_ahh, that explains some things I saw earlier16:22
* Keybuk believes in properly written shell scripts ;)16:22
ion_-e ftw.16:23
sadmac_It gets interesting when you're trying to debug stuff, and your ls's and tty's are failing and bringing everything to a halt16:23
Keybukheh16:24
sadmac_But now rhgb should work :D16:24
ion_You can always say set +e temporarily.16:24
sadmac_It makes me all tingly16:24
=== elmarco is now known as elmarco|bzz
ion_“Extra handling is required in both the pre-start and post-stop scripts depending on this variable”17:48
ion_keybuk: post-stop?17:48
Keybukion_: ref?17:53
ion_keybuk: The http://upstart.ubuntu.com/wiki/JobAtomicity page you mentioned. :-)17:53
Keybukion_: that's correct17:53
Keybukie. start apache HTTPS=yes17:53
KeybukHTTPS=yes should be set in post-stop17:53
Keybuksince it might have to undo things done in pre-start17:53
ion_keybuk: Does that conflict with what we talked about earlier, or am i missing something?17:53
Keybukno17:54
Keybukwhat we talked about earlier was something like17:54
Keybuk  stop on wibble17:54
Keybukinitctl emit wibble WIBBLED=YES17:54
Keybukthe pre-stop script will have two extra environment variables17:54
Keybuk  WIBBLED=YES17:54
Keybuk  UPSTART_STOP_EVENTS=wibble17:54
Keybukin addition to what all the other processes get17:55
Keybukpost-stop doesn't have those variables17:55
ion_Alright17:55
ion_keybuk: Wouldn’t it be better for multiple concurrent stop requests all blocked?18:05
ion_keybuk: And also if concurrent start requests all blocked until it’s running or it fails?18:06
KeybukI'm not sure20:11
Keybukwhat would be the benefit of multiple stop/start requests all blocking20:12
Keybuk[1] start apache HTTPS=yes20:12
Keybuk[2] stop apache20:12
Keybuk[3] start apache HTTPS=no20:12
Keybuksurely #1 should be cancelled and unblocked by #220:12
ion_Yes20:12
Keybukit shouldn't subsequently reblock because #3 happens20:12
ion_[1] start apache HTTPS=yes20:13
ion_[2] start apache HTTPS=no20:13
Keybuk#2 will fail because it's already started20:13
ion_apache should start with HTTPS=yes, but both should block IMHO.20:13
ion_Oh20:13
Keybukit has to fail, because even if it said "ok, and I'll block" it's lying to you20:13
ion_That’s okay, too.20:13
Keybuk(since it doesn't result in an apache with no http)20:13
Keybukstart will fail if the goal is already20:14
Keybuk+start20:14
Keybukstop will fail if the goal is already stop20:14
ion_Yeah, i’m fine with that.20:14
Keybukit used to be that in the 1/2/3 example above, #1 would actually block until apache stopped again20:14
Keybukand #2 would block for the same length of time20:14
Keybukthat seemed wrong to me20:15
Keybukif it's not going to start, it should unblock immediately and return an error code20:15
ion_Right20:16
Keybuklikewise the "stop apache" should unblock and return an error code when someone on another console tries to start apache again20:16
ion_Aye20:18
sadmacKeybuk: ...I did evil20:21
=== Amaranth_ is now known as Amaranth
sadmacKeybuk: http://sadmac.fedorapeople.org/rhgb20:21
sadmacput the tea down20:21
Keybukheh20:22
Keybukdoesn't seem bad to me20:22
KeybukI like the pre-start exec test -x thing :)20:22
Keybukyou know that post-start will be run*after* rhgb --no-daemon right?20:22
Keybukah, no, you appear to be deliberately waiting for the pts it creates20:22
Keybukso that's right20:22
Keybukpop-tty should probably be in the pre-stop script20:23
Keybukotherwise the pty will be gone while rhgb isn't20:23
Keybukbut hmm, pre-stop isn't run when it dies20:23
Keybukso yeah, post-stop it'll have to be20:23
sadmacbusy-waiting is scary.20:26
sadmacKeybuk: we could reeeely improve the elegance of all this if we could ship a working logd20:29
ion_Perhaps write a small script that uses inotify to wait for the file.20:29
sadmacion_: thinking about that. Is there a shell exposure of the necessary forms of inotify?20:30
ion_Uh, i meant program, as in a C program, unless something equivalent already exists.20:31
sadmacion_: ahh. yeah, I might.20:31
ion_There seem to be tools using inotify.20:31
ion_inotify-tools - command-line programs providing a simple interface to inotify20:32
ion_iwatch - realtime filesystem monitoring program using inotify20:32
ion_iwatch seems to depend on Perl.20:32
ion_I don’t know how they handle [ -e /foo ] || someinotifyprogram /foo when /foo appears after [ ] but before someinotifyprogram.20:35
sadmacion_: I have it inotify based now :)21:20
sadmacI'll see what the others concerned think21:21
ion_What did you use?21:22
sadmacion_: inotifywait -m /dev/pts 2> /dev/null | grep -m 1 "CREATE" > /dev/null21:44
ion_How about if /dev/pts/0 gets created before inotifywait is run?21:45
sadmacion_: its in an if [ -e ] block21:47
ion_There’s still a race condition. :-)21:47
sadmaca very small one21:48
ion_Aren’t they all? ;-)21:48
sadmacand as long as this damn thing takes to start I'm not worried.21:48
ion_Better start watching the directory first, then check for the file’s existence, and continue watching if the file doesn’t exist.21:52
Keybuksadmac: logd strikes me as a bit of a hack22:54
Keybukit shouldn't exist, instead one of the other logging daemons should be patched22:54

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