unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Neil Jerram <neil@ossau.uklinux.net>
To: <guile-devel@gnu.org>
Cc: Neil Jerram <neil@ossau.uklinux.net>
Subject: [PATCH] Fix hanging of popen.test
Date: Thu, 10 Jun 2010 23:54:56 +0100	[thread overview]
Message-ID: <1276210496-6477-1-git-send-email-neil@ossau.uklinux.net> (raw)

The "open-output-pipe":"no duplicate" test has been hanging, on and
off, and not completely reliably, for a few years.  It's now doing so
fairly reliably for me, and investigation shows that

- the child shell process is in a tight loop (99% CPU)

- the parent Guile process is stuck calling waitpid().

The problem is that the child hasn't got the SIGPIPE that the test
intends, and so is continuing to echo "closed" forever; and Guile is
waiting for it to terminate, forever.

I haven't fully debugged the SIGPIPE problem, but it sounds very like
what Chet Ramey describes here:
http://old.nabble.com/Re%3A-SIGPIPE-not-properly-reset-with-%27trap---PIPE%27-p20985595.html.

(And my version of bash is 3.2.39.)

So, a fix should be to use something other than shell to implement the
child; and it appears that this works.

* check-guile.in (TEST_SUITE_DIR): Export.

* test-suite/tests/popen-child.scm: New script file.

* test-suite/tests/popen.test ("open-output-pipe", "no duplicate"):
  Use Guile for the child process, instead of shell.
---
 check-guile.in                   |    1 +
 test-suite/tests/popen-child.scm |    4 ++++
 test-suite/tests/popen.test      |    5 +++--
 3 files changed, 8 insertions(+), 2 deletions(-)
 create mode 100644 test-suite/tests/popen-child.scm

diff --git a/check-guile.in b/check-guile.in
index dde51b3..fc670e1 100644
--- a/check-guile.in
+++ b/check-guile.in
@@ -15,6 +15,7 @@ top_builddir=@top_builddir_absolute@
 top_srcdir=@top_srcdir_absolute@
 
 TEST_SUITE_DIR=${top_srcdir}/test-suite
+export TEST_SUITE_DIR
 
 if [ x"$1" = x-i ] ; then
     guile=$2
diff --git a/test-suite/tests/popen-child.scm b/test-suite/tests/popen-child.scm
new file mode 100644
index 0000000..4bfe6b7
--- /dev/null
+++ b/test-suite/tests/popen-child.scm
@@ -0,0 +1,4 @@
+(close-port (current-input-port))
+(let loop ()
+  (display "closed\n" (current-error-port))
+  (force-output  (current-error-port)))
diff --git a/test-suite/tests/popen.test b/test-suite/tests/popen.test
index 0a20cff..a408c9e 100644
--- a/test-suite/tests/popen.test
+++ b/test-suite/tests/popen.test
@@ -167,8 +167,9 @@
     (let* ((c2p (pipe))
 	   (port (with-error-to-port (cdr c2p)
 		   (lambda ()
-		     (open-output-pipe
-		      "exec 0</dev/null; while true; do echo closed 1>&2; done")))))
+		     (open-output-pipe (format #f
+                                               "guile -s ~a/tests/popen-child.scm"
+                                               (getenv "TEST_SUITE_DIR")))))))
       (close-port (cdr c2p))   ;; write side
       (with-epipe
        (lambda ()
-- 
1.7.1




             reply	other threads:[~2010-06-10 22:54 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-10 22:54 Neil Jerram [this message]
2010-06-11 19:48 ` [PATCH] Fix hanging of popen.test Neil Jerram
2010-06-14 21:27   ` Andy Wingo
2010-06-28 21:48     ` Neil Jerram
2010-06-29  9:31       ` Andy Wingo
2010-06-29 19:11         ` Neil Jerram
2010-06-30 22:50           ` Neil Jerram
2010-06-30 23:58             ` Neil Jerram
2010-07-01 10:48               ` Andy Wingo
2010-07-01 20:29                 ` Patrick McCarty
2010-07-03 22:17                 ` Ludovic Courtès
2010-07-04  9:07                   ` Andy Wingo
2010-07-04 20:33                 ` Neil Jerram
2010-07-06 21:35                   ` Ludovic Courtès
2010-07-17 11:57                   ` Andy Wingo
2010-07-17 18:08                     ` Patrick McCarty
2010-07-01 16:22             ` dsmich
2010-07-01 21:22               ` Neil Jerram

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

  List information: https://www.gnu.org/software/guile/

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

  git send-email \
    --in-reply-to=1276210496-6477-1-git-send-email-neil@ossau.uklinux.net \
    --to=neil@ossau.uklinux.net \
    --cc=guile-devel@gnu.org \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).