From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <2b459c3d79844876c01956749cc7c35c@quintile.net> From: "Steve Simon" Date: Sat, 16 Dec 2006 14:55:24 +0000 To: 9fans@cse.psu.edu Subject: Re: [9fans] wait race? In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Topicbox-Message-UUID: f56ef35a-ead1-11e9-9d60-3106f5b1d025 >> for(i in `{seq 1 $n}){echo fu>/dev/null&} > If you can reproduce the "hang", can you run ps and see if > the pid that rc is waiting for. I can reproduce this quite easily, with n=150, one time in three the script hangs. Waitfor seems to be waiting for a proc which has already exited. felix% acid 63541 /proc/63541/text:386 plan 9 executable /sys/lib/acid/port /sys/lib/acid/386 acid: lstk() await()+0x7 /sys/src/libc/9syscall/await.s:5 wait()+0x1b /sys/src/libc/9sys/wait.c:13 buf=0x35323536 fld=0xdfffcc04 l=0x33930 w=0x33938 Waitfor(pid=0xff7e)+0xb4 /sys/src/cmd/rc/plan9.c:210 w=0x33938 p=0x36538 errbuf=0x33b4c Xbackq()+0x158 /sys/src/cmd/rc/havefork.c:120 wd=0x303531 ewd=0xdfffeeef stop=0x1d958 pfd=0x5 f=0x33938 s=0xdfffceef v=0x36538 c=0xa pid=0xff7e main(argc=0x1,argv=0xdfffefb4)+0x327 /sys/src/cmd/rc/exec.c:184 ... 0xff7e == 65406 felix% ps ... steve 63540 0:00 0:00 252K Await rc steve 63541 0:00 0:00 252K Await rc steve 63546 0:00 0:00 164K Pread stats steve 63547 0:00 0:00 168K Pread stats steve 63548 0:00 0:00 140K Pread clock steve 63549 0:00 0:00 140K Sleep clock steve 63550 0:00 0:00 376K Sleep faces steve 63551 0:00 0:00 376K Pread faces steve 63805 0:00 0:00 1116K Await rio steve 63806 0:00 0:00 252K Await rc steve 63807 0:00 0:00 124K Pread nedmail steve 63960 0:00 0:00 1116K Await rio steve 63961 0:00 0:00 252K Await rc steve 65153 0:00 0:00 8K Sleep sleep steve 65226 0:00 0:00 1116K Await rio steve 65227 0:00 0:00 252K Await rc steve 65228 0:00 0:00 228K Pread sam steve 65229 0:00 0:00 320K Rendez samterm steve 65230 0:00 0:00 320K Pread samterm steve 65231 0:00 0:00 320K Pread samterm steve 65232 0:00 0:00 320K Pread samterm steve 65233 0:00 0:00 320K Pread samterm steve 65251 0:00 0:00 1116K Await rio steve 65252 0:00 0:00 252K Await rc steve 65253 0:00 0:00 124K Pread nedmail steve 65419 0:00 0:00 200K Pread ps felix%