9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: erik quanstrom <quanstro@quanstro.net>
To: 9fans@cse.psu.edu, Russ Cox <rsc@swtch.com>
Subject: Re: [9fans] wait race?
Date: Fri, 15 Dec 2006 22:26:15 -0500	[thread overview]
Message-ID: <20061216032615.C6AC1221985@medicine-bow.quanstro.net> (raw)
In-Reply-To: <ee9e417a0612151812r74d8e0b4ka955dc57509d523a@mail.gmail.com>

russ,

you're spot-on, as per usual.  obvously, debugging when tired is
a dangerous thing for me.  i should have noticed the things you've 
pointed out right away.  the second or third cut-and-paste of that
command sequence usually does hang rc, which DEL fixes.

tomorrow, i will try to reproduce things.  (it was quite reliable.)
and see if i can get some more information.

the return value of write /sys/src/cmd/seq,c:84 & 92 is not checked,
but as you noted, that might not be the full story.

- erik

"Russ Cox" <rsc@swtch.com> writes

| 
| > this command frequently hangs on my terminal
| >         for(i in `{seq 1 $n}){echo fu>/dev/null&}
| 
| The back trace looks like rc is still trying to run seq
| (it is in Xbackq, which is running the backquote expression)
| and has not even gotten to the interesting part.
| 
| I might believe that if you ran two in a row:
| 
|           for(i in `{seq 1 $n}){echo fu>/dev/null&}
|           for(i in `{seq 1 $n}){echo fu>/dev/null&}
| 
| then that would make it hanging like that much more likely.
| 
| But what it might have seen instead is a read returning -1
| because it was interrupted by a sys: child note.  So seq might
| not actually be done.  That being said, there would still have to
| be a bug in the kernel (or seq), since rc has closed the pipe end
| that it is reading at that point, so seq shouldn't be blocked trying
| to write to it.
| 
| If you can reproduce the "hang", can you run ps and see if
| the pid that rc is waiting for (it's in the argument to Waitfor
| in the stack trace) is still running?  If so, what's that guy doing,
| and is it sed or is it rc?
| 
| Russ


  reply	other threads:[~2006-12-16  3:26 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-15 23:08 erik quanstrom
2006-12-15 23:46 ` matt
2006-12-16  0:51 ` geoff
2006-12-16  1:11 ` matt
2006-12-17 16:24   ` [9fans] ,m0 Matt
2006-12-17 16:40     ` Rob Pike
2006-12-17 16:41       ` Rob Pike
2006-12-17 17:01         ` Matt
2006-12-17 17:03         ` Paul Lalonde
2006-12-17 23:07           ` Bruce Ellis
2006-12-16  2:12 ` [9fans] wait race? Russ Cox
2006-12-16  3:26   ` erik quanstrom [this message]
2006-12-16  4:43     ` Russ Cox
2006-12-16 14:55   ` Steve Simon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061216032615.C6AC1221985@medicine-bow.quanstro.net \
    --to=quanstro@quanstro.net \
    --cc=9fans@cse.psu.edu \
    --cc=rsc@swtch.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).