/srv/irclogs.ubuntu.com/2007/06/22/#upstart.txt

=== Amaranth_ [n=travis@ubuntu/member/Amaranth] has joined #upstart
=== mbiebl_ [i=michael@conference/debconf/x-bd6bcb3ca59aabe6] has joined #upstart
=== mbiebl_ [i=michael@conference/debconf/x-d275a5993d6c8d6a] has joined #upstart
=== mbiebl_ [i=michael@conference/debconf/x-1297f79c091eafd5] has joined #upstart
=== kylem [n=kyle@amnesiac.heapspace.net] has joined #upstart
=== Amaranth [n=travis@ubuntu/member/Amaranth] has joined #upstart
=== Md [i=md@freenode/staff/md] has joined #upstart
=== tck [n=tck@212.2.170.159] has joined #upstart
=== phoenix24 [i=cixz@ns37986.ovh.net] has joined #upstart
=== phoenix24 [i=uko@ns37986.ovh.net] has joined #upstart
=== Keybuk [n=scott@quest.netsplit.com] has joined #upstart
=== phoenix24_ [i=gwxy@ns37986.ovh.net] has joined #upstart
=== phoenix24_ is now known as phoenix24
=== tck_ [n=tck@A-102-141.cust.iol.ie] has joined #upstart
Keybuktoday I feel like I have a handle of the event expression atomicity issues01:48
=== phoenix24_ [i=cwh@ns37986.ovh.net] has joined #upstart
=== juergbi [n=juerg@80-219-19-183.dclient.hispeed.ch] has joined #upstart
=== Amaranth [n=travis@ubuntu/member/Amaranth] has joined #upstart
KeybukInteresting question02:45
Keybukwhen upstart kills a process, should it just kill that process, or should it kill everything in that process's group?02:45
=== phoenix24 [i=jbj@ns37986.ovh.net] has joined #upstart
shawarmaKeybuk: Good question. What about the session?02:53
Keybukthe session?02:54
shawarmaYup.02:54
shawarmagetsid()02:54
Keybukyou can't kill a session02:55
shawarmaIf you SIGHUP the session leader, it trickles down to the other processes in the session.02:55
Keybukactually, it's more complicated than that02:56
shawarmaIf you SIGTERM the session leader, it doesn't kill the rest of the processes, afair.02:56
Keybukyou don't mean session leader02:56
Keybukyou mean process group leader02:56
shawarmaNo, I'm quite sure I mean session leader.02:56
Keybukand the SIGHUP thing only applies to the foreground process group with a controlling terminal02:57
Keybukiirc.02:57
shawarmaThat's the session leader.02:57
shawarmaGah.. getsid has no man page. Gimme a sec.02:57
Keybukthe session leader is the first process in the session?02:57
Keybukthe one where the sid == pid02:57
shawarmaRight.02:57
Keybuksetsid() gives you a process where pid == pgrp == sid02:57
shawarmaRight.02:58
Keybukie. it's the session leader and a process group leader02:58
Keybukprocess groups can exist without their leader02:58
Keybuksessions contain one or more process groups02:59
Keybuksessions can have a controlling terminal03:00
shawarmaRight.03:00
Keybukone of the process groups can be the foreground process group03:01
Keybukall of the others are the background process groups03:01
KeybukControl-C on the terminal will send SIGINT to all processes in the session's foreground process group03:01
Keybukif the terminal is hung-up, SIGHUP is sent only to the session leader03:01
shawarmaWhat causes the other processes in the session to die, then?03:02
KeybukControl-Z sends SIGTSTP to all processes in the foreground process gruop03:03
KeybukControl-\ sends SIGQUIT to all processes in the foreground process group03:03
Keybukreading from standard input while you are not in the foreground process group will send SIGTTIN back to you03:04
shawarmaABout SIGHUP: "This signal is also generated if the session leader terminates. In this case the signal is sent to each process in the foreground process group". Hmm.. Is it the kernel doing that?03:04
Keybukwriting to a terminal while you are not in the foreground process group may either succeed or send SIGTTOU back to you03:04
shawarma(from APUE)03:05
Keybukshawarma: dunno, not got that far yet (I'm in APUE too :p)03:05
shawarma*G*03:05
shawarmaI cheated and skipped ahead. :)03:05
Keybukchildren in a process group that are stopped are sent SIGHUP followed by SIGCONT if the process group they are in becomes orphaned03:07
Keybuk(ie. the parents of all processes in that process group are in different sessions)03:07
KeybukSIGHUP is only sent if there is a controlling terminal03:08
Keybukif the session leader terminates, SIGHUP is sent to the foreground process group (apparently)03:09
shawarmaBy whom?03:12
shawarmaMust be the kernel..03:12
Keybuk-- entering new session03:17
Keybukpid: 917103:17
Keybukpgrp: 917103:17
Keybuksid: 917103:17
Keybuk-- execing shell script03:17
Keybuk--shell03:17
Keybukpid: 917203:17
Keybukpgrp: 917103:17
Keybuksid: 917103:17
Keybuk--end shell03:17
Keybukok03:17
Keybukso that's a session leader that execs a shell, which runs a single command03:17
Keybukthe shell is 917103:17
Keybukthe process group and session of the simple command is also 917103:17
Keybukbut the pid of the thing run in it is 917203:17
Keybukwhich makes sense03:17
Keybukdoesn't get SIGHUP here03:24
Keybukaha03:26
Keybukdoes if it has a terminal03:26
Keybuk-- entering new session03:26
Keybuk-- taking control of terminal03:26
Keybukpid: 961803:26
Keybukpgrp: 961803:26
Keybuksid: 961803:26
Keybuk-- execing shell script03:26
Keybuk-- shell 961803:26
Keybukpid: 961903:26
Keybukppid: 961803:27
Keybukpgrp: 961803:27
Keybuksid: 961803:27
Keybuk-- end shell03:27
Keybuk9619 got SIGHUP03:27
Keybuk-- exit03:27
Keybukright03:27
KeybukSIGHUP comes from the terminal control driver only03:27
Keybukthat makes sense03:36
Keybukso the question is still valid03:36
shawarmaI forgot the question :)03:37
Keybukwhen upstart wants to kill a job, should it just send TERM to dash (which won't kill anything else since there's no terminal) or to the entire process group?03:37
Keybukand how will this affect services with multiple processes, since they'll all get TERM, rather than just the top one?03:38
shawarmaHow does that work, actually? You iterate throguh the process space looking for things with the same pgid?03:38
Keybukkillpg :p03:38
Keybukthom: how would apache cope with that?03:38
shawarmaI think each request each child is handling would be dropped and the top process would clean up the mess..03:40
Keybukyeah03:44
KeybukI think killpg is reasonable here03:44
Keybuk(it's also what sysvinit does ... I never noticed that)03:45
Keybuk*giggle*03:47
Keybukwell, that change royally buggered up my test suite03:47
=== Keybuk adds setpgrp() calls to the test children
=== tck [n=tck@213-202-136-190.bas502.dsl.esat.net] has joined #upstart
=== phoenix24 [i=wqsqpr@ns37986.ovh.net] has joined #upstart
=== phoenix24 [i=eff@ns37986.ovh.net] has joined #upstart
=== phoenix24 [i=ajfaxhw@ns37986.ovh.net] has joined #upstart
Keybukyay06:01
Keybukjob->cause is gone06:01
AlexExtremewhoo06:02
=== philippe_ [i=philippe@conference/debconf/x-29763299e36ef03e] has joined #upstart
Keybukthough I now have a stack of issues with the new code ;o)06:03
Keybukin particular06:03
Keybuk  start on foo and bar06:03
Keybuk  stop on frodo and bilbo06:03
Keybuk...06:03
Keybukif you stop that, and then foo happens quickly afterwards, it will start again06:03
Keybukbecause the event tree still has the true values, and it's still enough to touch it06:03
Keybukbut if it happens after it has properly stopped, you need both foo and bar to happen again06:03
Keybuk(likewise for the stop on bit)06:03
Keybukthe way to solve that, I think, is to reference an "Event Expression" not just the root "Event Operator"06:04
KeybukEvent Expression would be the root Event Operator, and also an Event State06:04
Keybukif the root operator becomes TRUE, the matching events from the tree are copied into the Event State, and then the operator tree is reset06:05
Keybukthe job would respond to the expression, so it retains the state while requiring the match to happen all over again06:05
=== mbiebl [i=michael@conference/debconf/x-95c94991903206ad] has joined #upstart
=== Md [i=md@freenode/staff/md] has joined #upstart
=== phoenix24 [i=pdadzx@ns37986.ovh.net] has joined #upstart
=== phoenix24 [i=ychwysy@ns37986.ovh.net] has joined #upstart
=== tck [n=tck@78.16.83.141] has joined #upstart
=== tck_ [n=tck@213-202-139-46.bas502.dsl.esat.net] has joined #upstart
=== phoenix24 [i=zaqabkr@ns37986.ovh.net] has joined #upstart
=== phoenix24 [i=can@ns37986.ovh.net] has joined #upstart

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