unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* [PATCH] Fix hanging of popen.test
@ 2010-06-10 22:54 Neil Jerram
  2010-06-11 19:48 ` Neil Jerram
  0 siblings, 1 reply; 18+ messages in thread
From: Neil Jerram @ 2010-06-10 22:54 UTC (permalink / raw)
  To: guile-devel; +Cc: Neil Jerram

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




^ permalink raw reply related	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2010-07-17 18:08 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-10 22:54 [PATCH] Fix hanging of popen.test Neil Jerram
2010-06-11 19:48 ` 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

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).