9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "Russ Cox" <rsc@swtch.com>
To: "Fans of the OS Plan 9 from Bell Labs" <9fans@cse.psu.edu>
Subject: Re: [9fans] wait race?
Date: Fri, 15 Dec 2006 21:12:12 -0500	[thread overview]
Message-ID: <ee9e417a0612151812r74d8e0b4ka955dc57509d523a@mail.gmail.com> (raw)
In-Reply-To: <9ad68ddb26c79d699d261fdf5fbdc505@coraid.com>

> 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


  parent reply	other threads:[~2006-12-16  2:12 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 ` Russ Cox [this message]
2006-12-16  3:26   ` [9fans] wait race? erik quanstrom
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=ee9e417a0612151812r74d8e0b4ka955dc57509d523a@mail.gmail.com \
    --to=rsc@swtch.com \
    --cc=9fans@cse.psu.edu \
    /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).