/srv/irclogs.ubuntu.com/2006/11/29/#upstart.txt

=== Amaranth [n=travis@ubuntu/member/amaranth] has joined #upstart
=== theCore [n=alex@modemcable229.181-131-66.mc.videotron.ca] has joined #upstart
=== theCore [i=alex@gateway/tor/x-609a03f7c1992d97] has joined #upstart
=== theCore [n=alex@modemcable229.181-131-66.mc.videotron.ca] has joined #upstart
=== theCore [n=alex@modemcable229.181-131-66.mc.videotron.ca] has joined #upstart
=== Amaranth [n=travis@ubuntu/member/amaranth] has joined #upstart
=== theCore [n=alex@modemcable229.181-131-66.mc.videotron.ca] has joined #upstart
=== theCore [n=alex@modemcable229.181-131-66.mc.videotron.ca] has joined #upstart
=== theCore [n=alex@modemcable229.181-131-66.mc.videotron.ca] has joined #upstart
=== wasabi__ [n=wasabi@cpe-76-184-95-8.tx.res.rr.com] has joined #upstart
=== theCore [n=alex@modemcable229.181-131-66.mc.videotron.ca] has joined #upstart
=== Kamping_Kaiser [n=kgoetz@easyubuntu/docteam/kgoetz] has joined #upstart
=== Amaranth [n=travis@ubuntu/member/amaranth] has joined #upstart
=== Kamping_Kaiser [n=kgoetz@easyubuntu/docteam/kgoetz] has joined #upstart
=== Keybuk [n=scott@quest.netsplit.com] has joined #upstart
=== Md [i=md@freenode/staff/md] has joined #upstart
=== Md [i=md@freenode/staff/md] has joined #upstart
=== mbiebl [n=michael@e180120209.adsl.alicedsl.de] has joined #upstart
AlexExtremestrange11:17
AlexExtremeis it normal that my karma in launchpad goes up without me doing anything?11:17
Kamping_Kaiseryeh, LP is whacko11:19
AlexExtremeheh11:19
=== AlexExtreme disappear again
Keybukheh11:28
_ionIt would be easy to make a script that creates a graphviz graph alike the one in the wiki of the current system, btw. It would just need a purely informational stanza about events a job may emit, e.g. fhs_check could contain 'emits fhs-filesystem-mounted fhs-filesystem-unmounted'.11:34
Keybukyeah11:35
_ionI'll probably write that script later.11:36
Kamping_Kaiserdidnt notice you here Keybuk 11:36
Keybuk... I have always been here ...11:38
Kamping_Kaiser... oh ...11:38
_ionafter the complex-event-config spec is final.11:38
KeybukKamping_Kaiser: actually, that's a lie, I can't back that up11:41
Keybuk_ion: http://upstart.ubuntu.com/wiki/Emits11:52
_ionkeybuk: Nice, thanks.12:02
_ionkeybuk: Hm, will all that information (the "start/stop on" and the "emits" events) about current jobs be exposed via libupstart? I could just write the bindings for libupstart and use them.12:14
KeybukI think so12:15
Keybuknot sure which works best12:15
Keybukhave a tool ask upstart for job relationships12:15
Keybukor parse the configuration files itself12:15
_ionYeah, that's what i'm pondering. :-)12:18
KeybukI think the former, that way what you see is always consistent with what upstart knows12:18
Keybukand allows for future registry of jobs from other sources (e.g. autostart files)12:18
_ionYeah.12:18
=== Kamping_Kaiser [n=kgoetz@easyubuntu/docteam/kgoetz] has left #upstart ["More]
=== _ion [i=johan@kiviniemi.name] has joined #upstart
wasabimorning folks03:09
Keybukheyhey03:09
wasabiwhere did we leave off yesterday?03:10
wasabiOh yes! Yeah. You have a real job. It just seems like it's too good to be real. ;)03:10
Keybukit has its downsides, like any other03:10
KeybukI'm just going through the specs tidying them up and marking those we're pretty much agreed on as approved03:14
Keybukwell, that was a conversation killer :p03:24
wasabiHeh.03:31
Keybukso, I was thinking on last night's conversation03:37
KeybukI'm convinced that the eight-stage state machine is correct, though the names could do with a little tweaking03:37
Keybukhowever I think I agree that there should not be eight corresponding events03:38
Keybukthe main reason being that the paths through the state machine aren't circular03:38
Keybuke.g. you could have a start event, but a failure along the way, which could cause you to go straight to stopped03:38
Keybukso anything with "from start FOO to stop FOO" wouldn't actually get stopped03:38
Keybukand I think that inconsistency is bad03:39
Keybukgoing through all the examples, I couldn't find anything that really needed that level of complexity03:39
Keybukso I propose keeping the state machine *but* reducing the events03:39
Keybukin fact, there should be just two pairs03:39
Keybuk"start"/"starting" = goal changed to start, process begun03:39
Keybuk"stop/stopping" = goal changed to stop, process begun03:40
Keybuk"started" = process of starting finished03:40
Keybuk"stopped" = process of stopping finished03:40
Keybukthese events would be emitted at the most appropriate places in the state machine03:40
wasabiI agree wholeheartedly.03:40
Keybukand would always go03:40
Keybukstarting -> started03:40
Keybukor03:40
Keybukstarting -> stopping -> stopped03:40
Keybukor stopping -> stopped03:40
Keybukor stopping -> starting03:40
Keybuketc.03:40
Keybukso they make logical sense03:40
wasabiYes.03:40
Keybukif you get a starting event, you ALWAYS get at least stopping03:41
wasabiMakes sense.03:41
Keybukand if you get a stopping event, you ALWAYS get at least starting following03:41
wasabiSo, if pre-stop fails, it'll emit starting again?03:41
Keybukright03:42
Keybukgoal changes back03:42
wasabiBut not actually traverse through pre-start and post-start.03:42
Keybukyup03:42
wasabiSuper.03:42
Keybukthis also gives us an interesting idea03:42
Keybukthe started/stopped events are just "now at rest" events03:42
wasabiYup.03:42
Keybukbut the starting/stopping events are "goal being changed"03:42
Keybukwe could delay any action on those two events until they've been hancled03:43
Keybukuh, handled03:43
=== j_ack [n=rudi@p508D8B8E.dip0.t-ipconnect.de] has joined #upstart
Keybukso:03:43
Keybukstart ssh => sets goal to start => emits "starting ssh" => waits for event to finish => changes state to pre-start03:43
Keybuklikewise for stopping03:43
Keybukstop ssh => sets goal to stop => emits "stopping ssh" => waits for event to finish => changes state to pre-stop03:44
Keybukso for the more usual example:03:44
Keybuktomcat could be started on starting apache; which means that apache won't be started until apache is actually running03:44
Keybukuh tomcat is actually running03:44
wasabiYes. That makes sense for apache/tomcat.03:45
Keybuknetwork-manager could be stopped on stopping dbus; which means that dbus won't be stopped until network-manager has been stopped03:45
wasabiAnd that also makes perfect sense.03:45
Keybukare there any examples of something you would run "on starting" or "on stopping" which _shouldn't_ delay the named job?03:45
wasabiAnd in both cases the definition of the dependency is described from the POV of the depending service.03:45
wasabiSay that again?03:45
wasabiAhh I see.03:46
wasabiI'm unsure.03:46
wasabiI can't see it.03:47
wasabiI think the most likely case is desiring a service to run on started.03:47
wasabiWhich leaves the emitting job at rest, done, so blocking doesn't matter.03:48
wasabiAnd I can't imagine any circumstances where that isn't good enough.03:49
_ionI agree with having only starting/stopping/started/stopped emitted.03:49
_ionAnd with "on starting" and "on stopping" causing the emitting job to wait.03:50
wasabiI think the only desire to have something start but not block "starting" is simply because it's reactionary, but independent. It doesn't actually care about the state of the first job.03:51
wasabiThus making it more async.03:51
wasabiAnd I would probably say that that could be handled better. Don't make your job block.03:52
wasabiLet it start quick.03:52
_ionCan you think of an use case for having "on starting" without blocking?03:52
Keybukhow would you define that, though?03:52
wasabiDefine it? By geting through pre-start FAST.03:52
Keybuk*confused*03:53
wasabiDon't just spin in pre-start.03:53
wasabiWell, the blocking is only waiting for the dependent job to be started03:53
Keybukthe only use cases I can think of for "on starting" do suggest blocking03:53
wasabiWhich is waiting from child stopped->started03:53
Keybukyeah03:53
wasabiI can't imagine that being slow enough to be unsatisfactory justify 03:54
wasabis/justify//03:54
wasabiI guess the only potential bottleneck I can think of is that if somebody wants to have their job run before apache runs, but their job is waiting on some other external resource before it starts.03:59
wasabiAnd they represent that waiting by spinning in pre-start =)03:59
KeybukI'd argue that's a bug anyway :)03:59
wasabiAnd that seems pretty broken anyways.03:59
wasabiYeah03:59
wasabirunning to work now04:02
wasabiAre we suseptable to any sort of feedback loop with this?04:03
wasabiOr deadlocking04:03
Keybukyou can be deadlocked by two jobs04:04
Keybukfoo:  start on starting bar04:04
_ionA "start on starting B" and B "start on starting A"?04:04
Keybukbar:  start on starting foo04:04
Keybukactually, no you wouldn't04:05
_ionThat could be easily detected, couldn't it?04:05
Keybukbecause the "starting bar" event wouldn't affect foo, because it's goal is already set04:05
Keybukbar would start immediately04:05
Keybukand thus foo would too04:05
_ionAh, nice.04:06
=== mbiebl [n=michael@e180120209.adsl.alicedsl.de] has joined #upstart
=== Amaranth [n=travis@ubuntu/member/amaranth] has joined #upstart
Keybukhmm04:47
Keybukwhat to do about respawn?04:47
Keybukwould you want an event for that?04:47
Keybukshould it be when it notices the job has died, or when it has successfully restarted it?04:48
wasabi_back04:53
_iondied foo 42   exit value04:53
_ionstopped foo04:53
_ionstarting foo04:53
_ionstarted foo04:53
_ion?04:53
wasabi_Nice.04:53
wasabi_I don't think an event is required for respawn specifically as much as "died"04:54
wasabi_And I *love* the idea of including the exit code in the event args04:54
wasabi_That's slick.04:54
Keybukfailed?04:54
Keybukwe have that already04:54
wasabi_Yeah.04:54
Keybukmy only concern there is that it'd cause any service using starting or stopping to get restarted04:54
wasabi_"jobname failed 1"04:54
Keybukbut maybe that's right too04:54
wasabi_Hmm.04:55
Keybukactually, it'd only do it for anything on stopping04:55
Keybukso if dbus died, all the dbus services would get restarted04:55
wasabi_That is most certainly appropiate.04:55
wasabi_At least in that case.04:55
KeybukI suspect if something really needs to be stopped on stopping, and block the parent, that does imply that the connection is critical04:56
wasabi_I think failed is definatly a bug, as in, something which should never happen. But when it does, it's best to be conservative.04:56
Keybukso does imply that respawning one means to respawn the other04:56
wasabi_When it fails, run the post-stop scripts, which would clean up on service stop.04:56
wasabi_Then cycle back through to start.04:56
wasabi_Also, the post-stop script, and in fact the pre-start script will have access to the event that caused it. Including args.04:57
wasabi_[ "$1" == "failed" ]  04:57
Keybukyeah04:57
Keybukok, so another topic04:58
wasabi_There are cases where we have known buggy software, that people want to run, but we know is going to crash.04:58
wasabi_(nscd)04:58
Keybuk(from the same spec)04:58
_ionHmm, if foo: "start on stopping bar" and bar fails, foo should be stopped. Should there be some magic, or should there be a dummy "stopping bar" event right after the "failed bar" event?04:58
wasabi_I think I lean towards having a dummy event.04:59
_ionMe too.04:59
wasabi_You know, we might not even have a failed event.04:59
_ionWhoops, i meant foo: "stop on stopping bar"05:00
=== Keybuk thinkgs about "start on failed self" again
wasabi_Are we going to use job names as events or start/stop ?05:00
wasabi_We should decide that once and for all. ;)05:00
Keybukwasabi: right, so let's discuss that now05:00
Keybukthere's a good reason (imo) to make events have a _different_ namespace to jobs05:01
Keybukthe example event is the block-device-added event05:01
Keybukwe can write things like /etc/event.d/mount-filesystem with "on block-device-added"05:01
Keybukbut someone is going to try and write /etc/event.d/block-device-added05:01
Keybukthis has several effects05:01
wasabi_Hmm.05:01
Keybuk1) it doesn't get triggered, whey they probably expect it to -- no matter, they can add "on block-device-added" in it05:02
wasabi_Weird events being mixed.05:02
Keybuk2) so the block-device-added hda event from udev now starts the block-device-added job05:02
wasabi_You'd get block-device-added events with data that was not in fact a block device name05:02
Keybuk3) which emits the block-device-added starting event05:02
Keybukand poor mount-filesystem would get both05:02
wasabi_You win. =)05:02
Keybukthis is a real world problem05:02
Keybuksomeone (me) shipped /etc/event.d/control-alt-delete in Ubuntu <g>05:03
wasabi_Heh.05:03
Keybukwhich is why the event got renamed05:03
Keybukso I think in general we want to keep the namespace separate05:03
Keybukand I think it's never useful to say "on JOBNAME" and get started whenever that job changes state05:03
wasabi_The only reason I was thinking the other way was for our reusable complex event stuff.05:04
Keybukbut it's potentially useful to have "on STATE" (on failed) and get started whenever any job reaches that state05:04
KeybukI don't think there's much semantic difference between05:04
wasabi_/etc/event.d/some-reusable-state-machine05:04
Keybuk    from started apache until stopping apache05:04
Keybukand05:04
Keybuk    from apache started until apache stopping05:04
Keybukwhich is the only real difference05:04
wasabi_Yeah. Agreed.05:04
=== _ion totally agrees with Keybuk
Keybukthe reusable complex event stuff defines states which have the various events05:04
wasabi_I'm on board now. ;)05:04
Keybuknot a single up/down event05:04
Keybukthe cute thing about that is you can define pre-start and post-stop scripts for your reusable state machines <g>05:05
wasabi_Yeah.05:05
Keybukof course, this all means that /etc/event.d isn't the right name anymore05:05
Keybukit's a directory that defines jobs, services, tasks and states05:05
wasabi_But not events. ;)05:06
KeybukI agree that /etc/event.d/FOO implies that FOO is an event, and the content of the file is what happens on it05:06
wasabi_Explicitly not events, yet we call it event.d hehe05:06
Keybukso I think we should rename that directory05:06
_ionTBH, i was never very fond of the name "event.d".05:06
wasabi_Well, we need a name which better describes { jobs, services, tasks and states }05:07
Keybukhttp://upstart.ubuntu.com/wiki/JobEvents05:08
Keybuk^ suitable for approval?05:08
wasabi_reading05:08
_ion/etc/upstart would be quite obvious, but perhaps that would be better preserved for possible configuration of upstart itself, such as the profiles spec.05:08
wasabi_I'm curious how internally you will deal with respawning.05:09
Keybukwasabi_: I'm edging closer and closer to dropping it entirely from the internal state05:09
wasabi_You have the concept of a goal, which is essentially an enum set on a job, and the job works towards that state.05:09
wasabi_Ahh.05:09
KeybukI think that respawn just indicates that the job doesn't change goal when it dies05:09
wasabi_But in the case of restart, your goal is started, but you have to instruct the machine to cycle to that.05:09
Keybukwe can still kick it into stopping, and let it come back as if it had been manually restarted05:09
wasabi_True.05:10
Keybukso it'll go stopping -> starting -> started05:10
Keybukactually, it'll go failed -> stopping -> starting -> started05:10
KeybukI sometimes wonder whether someone with far more forethought than I wrote it :p05:10
wasabi_You'd kick it into post-stop, basically.05:10
Keybukright05:10
_ion"Events emitted as part of a job state change are currently named after the job, with a suffix indicating the new state."05:10
wasabi_And it would just cycle back around naturally.05:10
_ionIsn't that the other way around?05:10
Keybuk_ion: apache/started 05:10
_ionSorry, i missed the word "currently" and misinterpreted the sentence.05:11
KeybukI usually try in the summary to first say how things are, then say what the spec proposes05:12
_ion"it'll go failed -> stopping -> starting -> started"  Shouldn't "stopped" be there after "stopping"?05:15
Keybukerr05:16
Keybukyes05:16
_ionHave i understood this correctly:05:19
_ion When admin stops a job: "stopping foo", pre-stop script, kill proces, post-stop script, "stopped foo"05:21
_ion When a process exits by itself: "failed foo exitval" IF it failed, "stopping foo", pre-stop script, post-stop script, "stopped foo"05:22
Keybukyes05:22
wasabi_It might be worth thinking about removing "failed", and replacing it with a third argument to "stopping".05:23
wasabi_I might be totally offbase there.05:23
_ionThen "foo" would need to know what exit value "bar" has when it fails or doesn't fail.05:23
wasabi_If it's set to respawn, any exit code is a failure.05:24
wasabi_Even 0.05:24
wasabi_At least, that's how I understand it.05:24
wasabi_Maybe I'm wrong there too.05:24
Keybukcorrect05:25
Keybukor any value in normalexit05:25
wasabi_Consider this. A piece of software, such as a java application server (which I can attest operates this way), which has a built in shutdown/startup interface.05:26
wasabi_So, it's possible to shutdown this server using it's built in web interface. This does not instruct upstart to in fact shut it down.05:26
wasabi_It could, but any such patches to do so would have to be written.05:27
wasabi_Instead, it terminates normally with exit 0.05:27
wasabi_Even though you want it to respawn on crash.05:27
wasabi_So, basically, you would desire upstart to "respawn on !0"05:27
Keybukright05:28
Keybukrespawn05:28
Keybuknormal exit 005:28
Keybuk(this works today)05:28
wasabi_Ahh. Cool.05:28
wasabi_So, that would result in upstart running post-stop, and emitting stopping and stopped.05:29
Keybukyes05:29
wasabi_Nice.05:29
=== mbiebl [n=michael@e180120209.adsl.alicedsl.de] has joined #upstart
Keybukwasabi: what if a post-start script fails?06:47
Keybukremind me06:47
KeybukI think your description says it kills the process06:49
=== Amaranth [n=travis@ubuntu/member/amaranth] has joined #upstart
=== j_ack [n=rudi@p508D8B8E.dip0.t-ipconnect.de] has joined #upstart
=== treetop [n=treetop@88-212-90-121.vl20-cph.dhcp.clearwire.dk] has joined #upstart
=== j_ack [n=rudi@p508D8B8E.dip0.t-ipconnect.de] has joined #upstart
wasabi_I think if post-start fails, it would proceed to "stopped" along normal paths.08:16
wasabi_Hmm. Guess not./08:17
wasabi_Guess it would skip to stop (bypassing pre-stop)08:17
wasabi_kill the process, then post-stop.08:17
Keybukwhat about if the pre-stop fails?08:51
Keybukwhich is kinda interesting09:07
Keybukassuming we issue the stopping event first, and hold on that, then things will need to be restarted09:07
Keybukso you'd have to go stopping -> starting -> started again09:08
Keybukwithout actually doing anything :p09:08
Keybukalternatively one could wait to issue the stopping event until after pre-stop, but that negates the pre-stop being used to instruct the server to shut down safely09:08
wasabi_pre-stop wouldn't be used to instruct it to shut down.09:25
wasabi_It would be used to determine if it should actually shutdown.09:25
wasabi_Maybe that's what we're missing?09:25
wasabi_So, it isn't in fact going to stop until pre-stop says it can.09:25
Keybukthe trouble with that is that you've already issued the stopping event, haven't you?09:26
Keybukor do you wait until pre-stop says you can?09:26
KeybukI can see both uses for the script09:26
wasabi_Hmmm. Also makes me wonder if we in fact need a "start"/"stop" script seperatly from exec.09:28
wasabi_pre-stop i think is and idea we had simply to prevent stopping.09:29
wasabi_I'm not even sure that is even neccassary.09:29
wasabi_I'd say, if there is some actual shell script that is run that iniates the stop, it might be seperate from all of this, and a companion with "exec"09:29
wasabi_exec foo09:29
wasabi_stop script09:30
wasabi_   do something to kill foo09:30
wasabi_end script09:30
wasabi_pre-start;start;post-start,  pre-stop;stop;post-stop,  where start and stop can run at the same time. Each can be expressed by "name {exec|script}"09:33
wasabi_So, exec, logically, becomes "start exec".09:34
wasabi_JUst like we would have "post-start exec", or various other uses.09:34
Keybuk * all works fine: starting, started, stopping, stopped09:34
Keybuk * pre-start fails: starting, failed, stopping, stopped09:34
Keybuk * post-start fails: starting, failed, stopping, stopped09:34
Keybuk * binary fails: starting, failed, stopping, stopped09:34
Keybuk * binary respawns: starting, started, failed, stopping, starting, started09:34
wasabi_start/stop are runnable at the same time. while start is still going, we are at rest.09:35
Keybukthose are the event sequences I've come up with so far09:35
Keybukprobably:09:35
Keybuk * binary terminates badly: starting, started, failed, stopping, stopped09:35
Keybukas well09:35
wasabi_I think there are a number of differnet things represented there which need to be thought about seperatly.09:36
wasabi_1) emitted events09:36
wasabi_2) "status" of job09:36
Keybukthose are simply emitted events09:36
wasabi_3) internal status of job used to maintain state machine09:36
wasabi_Okay09:37
Keybuktrying to work out what works best09:37
wasabi_2), the queryable statuses I see are "starting", "started", "stopping", "stopped". initctl can get the status of a job and return only those 4.09:37
Keybukdo those event sequences make sense?09:37
wasabi_4) executable steps09:37
wasabi_Yes I believe so.09:37
Keybukthe respawn one is the odd one, as it never reaches "stopped"09:38
Keybukit's stopping, then it's starting again09:38
wasabi_Yeah.09:38
wasabi_MIght emit stopped anyways.09:38
KeybukI think that makes sense, if a job is "stop on stopped foo", and foo respawns, it doesn't get restarted; where a job that's "stop on stopping foo" does09:38
wasabi_Since another job may be watching for it.09:38
Keybukthe problem is working out where to emit events09:38
wasabi_You could emit stopped, but there would be no point at which you could query and return "stopped"09:39
Keybukemitting stopped there is damned hard09:39
wasabi_Just let the mainloop run twice.09:39
Keybukno such thing09:39
wasabi_I mean, you don't let it do that, you iterate and set it to stopped, and run the normal stopped code, which emits the event, and then it runs again immediatly after and progresses.09:39
Keybukonce it hit stopped, nothing would get it back out again09:40
wasabi_Sure, it's at stopped, but hte goal isn't stopped.09:40
Keybukyes09:40
wasabi_So the next loop would send it to starting again09:40
Keybukbut what would pick that up?09:40
Keybukyou'd need something in the main loop checking every single job09:40
Keybukwhich is damned ineffecient09:40
wasabi_Ahh.09:40
wasabi_Well, I suspect you will end up with an idle bit someplace.09:41
Keybukright now, it flows because each change causes the next09:41
KeybukI'm trying to drop the idle bit :)09:41
wasabi_if goal != state idle = false;09:41
wasabi_hmm. i see.09:41
wasabi_idle = (goal == state) actually.09:41
wasabi_Then always "process" jobs where !idle, after work, reset idle again.09:42
wasabi_4) executable steps. these are basically PIDs that are being tracked.09:42
wasabi_4) pre-start, start, post-start, pre-stop, stop, post-stop09:43
wasabi_They can be expressed as "name [exec|script]  ..."09:43
wasabi_start exec foo, start script\n foo\nend script09:43
wasabi_pre-start exec, pre-start script. Same stuff.09:44
Keybukhttp://people.ubuntu.com/~scott/states.png09:44
Keybuk(reload)09:48
Keybuk(reload again)09:48
Keybukfollow the green lines while the goal is start09:48
Keybukfollow the red lines while the goal is stop09:48
wasabi_These are events?09:49
Keybukstates09:49
wasabi_Didn't think pre-start and such would be states.09:49
Keybukwhy not?09:49
Keybukthey represent discreet points in the lifecycle09:49
wasabi_okay i see09:50
Keybukstarting is where we fork the process09:52
Keybukstopping is where we kill it09:52
Keybukwe emit the "started" event when we hit "running"09:52
Keybukand the "stopped" event when we hit "waiting"09:52
Keybukwhere to emit the starting and stopping events is the tricky one <g>09:52
wasabi_I might say we emit the stopped event when we finish post-stop.09:52
Keybukright now I have them being emitted when the goal changes, so completely outside that diagram09:52
Keybukdoesn't work if you don't have a post-stop09:53
wasabi_and we emit the started event when we finish post-start, to keep it simple.09:53
wasabi_The machine would always progress through post-stop, but if there was no post-stop PID to run/track, it would just be done.09:53
wasabi_And on completion, it emits event.09:53
Keybukit'd enter post-stop, but then you'd need some kind of "ok, what state was I just in?" thing09:53
wasabi_Not really, always, at the end of post-stop, emit stopped event.09:53
wasabi_Regardless of what happened previously.09:54
Keybukno such thing as "end of"09:54
wasabi_You'd want to emit stopped on a respawn.09:54
Keybukwe define an end of a state by changing to a different one09:54
Keybuksee, I'm not sure we do09:54
wasabi_Sure there is. End of just just hte last step in the small machine known as "post-stop09:54
Keybukwhy does respawn need to say the job is stopped?09:54
Keybukit never really is09:54
wasabi_Functionally it isn't available, or has gone up and down.09:54
wasabi_And thus you would have to reconnect.09:54
wasabi_nm/dbus.09:54
Keybukright, but I think anything that connects will be hanging on the started and stopping events09:55
KeybukNOT the starting or stopped events09:55
Keybukbecause those implicitly don't allow connection09:55
wasabi_nm could do from (dbus started until dbus stopping) or (dbus started until dbus failed)09:55
wasabi_but that would be a bit obnoxious.09:55
Keybukyou'd always get stopping09:55
wasabi_Hmm. the blue line skips over it09:55
Keybukyou're confusing a state with an event09:56
Keybukthat's probably my fault :p09:56
Keybukthose stopping and starting are just the interim states, nothing to do with the events09:56
KeybukI haven't renamed them yet09:56
wasabi_that diagram should have events hanging off of each step.09:56
wasabi_heh09:56
Keybukthat doesn't work if we don't have an event for each step :p09:56
wasabi_Okay, so stopped would not be emitted... so in that case:09:56
Keybukthe point is that we're having events to indicate which way round we're going, *not* where we are09:56
wasabi_from (dbus starting until dbus stopped) or (dbus starting until dbus failed)09:57
wasabi_Since stopped isn't emitted when failed is.09:57
wasabi_But the conditition is functionally the same.09:57
Keybukah09:57
Keybukfrom starting dbus until stopped dbus09:57
wasabi_ie no service running, can't connect to it.09:57
Keybuk^ I don't need to connect to dbus, just be around when it is  (and it should wait for me to be around)09:57
wasabi_dbus is a bad example there.09:57
wasabi_It was just in my buffer and I didn't want to retype.09:57
Keybukbetter example09:57
Keybukfrom starting apache until stopped apache09:58
wasabi_Yeah.09:58
Keybukapache needs me to be started first, and needs to be stopped before I am09:58
Keybukthe counter-example is09:58
Keybukfrom started dbus until stopping dbus09:58
KeybukI need dbus to be around, and I don't want dbus to be stopped until I am09:58
wasabi_{...dbus...{...nm...}...}09:58
Keybukour first example wouldn't get restarted if apache respawned (no need, apache depends on it, not the other way around)09:59
Keybukour second example would get restarted whenever dbus respawned09:59
wasabi_{...tomcat...{...apache...}...}09:59
wasabi_Yeah I think you're right. If tomcat can run without apache, then it doesn't matter if it knows that apache just died.10:00
wasabi_Because apache will just come back.10:00
wasabi_But the situation described is still right. tomcat will always be running while apache is.10:00
Keybukfrom started foo until stopped foo -- I suspect this will be rare; it implies that foo must start first, but you don't really need foo, as it's ok for it to stop10:00
Keybukfrom starting foo until stopping foo -- odd, foo has to wait for you to start, and wait for you to stop -- some kind of strange hold; this works in the respawn example though10:01
wasabi_{foo  {bar   }foo   ?bar10:01
wasabi_Here's an interesting thing.10:02
wasabi_dbus will be considered started, and nm will launch.10:02
wasabi_But dbus might not have actually opened it's socket and been completely prepared.10:03
Keybukthat's what the post-start script is for, and why the started event isn't emitted until that finishes10:03
wasabi_And hence post-start can hold nm from starting until dbus is sure it's up.10:03
wasabi_And that is just totally kick ass.10:03
wasabi_Easy race elimination.10:03
Keybukpre-stop is the tricky one10:04
Keybukdo we emit stopping before pre-stop, and wait for other jobs to finish first?10:04
wasabi_Yeah, interesting.10:04
Keybukor do we run pre-stop first, and then only emit stopping after - waiting for other jobs to finish before killing the process?10:04
wasabi_I think that's probably best.10:06
Keybukwhich means the stopping event is tricky10:09
wasabi_1) execute and wait for pre-stop 2) if going to stop emit and wait for stopping, else reset back to started 3) execute and wait for stop (procedure to terminate process) 4) execute and wait for post-stop10:15
Keybukhttp://people.ubuntu.com/~scott/states.png10:22
Keybukreload again10:22
Keybukfollow the green lines when the goal is start10:22
Keybukfollow the red lines when the goal is stop10:22
Keybukfailure of a step sets the goal to stop10:22
Keybuknote:10:23
Keybukrunning can terminate normally, and change the goal to stop (the red line out marked "normal")10:23
Keybukthis goes to pre-stop10:23
Keybukrunning can terminate badly, and change the goal to stop (the red line out marked "failed")10:24
Keybukerr10:24
Keybuksorry10:24
Keybukthe one marked failed is supposed to be marked "terminated"10:24
Keybukthe normal one is a stop request or event10:24
Keybukthe idea there is that you skip pre-stop and "kill process" if the process died10:24
Keybukthere's a red and green line in that direction, because respawn doesn't change the goal10:25
Keybukpre-stop can change the goal back to start, so there's a green line back to running again10:25
Keybukdoes that look right?10:42
wasabi_still parsing10:45
wasabi_between writing an application deployment lifecycle policy and procedures document for the audit guy. blah.10:45
wasabi_Is there a way in dotty to make a big grouping of pieces of this?10:47
KeybukI think so, yes10:47
wasabi_Like, off to the right side, a big line which says what parts are in a group. stopped, starting, started, stopped.10:47
Keybukwhat would be in those groups?10:48
wasabi_stopped would be "waiting"10:48
Keybuk?10:48
wasabi_starting would be [emit starting, pre-start, exec process, post-start] 10:48
wasabi_started would be [emit-started, running, pre-stop] 10:49
wasabi_stopping would be the rest. get it?10:49
KeybukI'll see what I can make it do :)10:49
wasabi_What I mean, is representing the queryable state of the job at every given point.10:49
Keybukreload11:00
Keybukthough dot mangled that a bit :p11:00
Keybukright bed, will mull on that a bit11:08
Keybuknite11:08
=== mbiebl [n=michael@e180095208.adsl.alicedsl.de] has joined #upstart

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