RUN-PROGRAM sometimes hangs in 0.13

Gary Byers <[email protected]> Tue, 3 Sep 2002 14:26:03 -0600 (MDT)
Newsgroups gmane.lisp.openmcl.bugs
Message-ID <[email protected]>
A usually-dormant lisp thread (the value of CCL::*EXTERNAL-PROCESS-WATCHDOG*)
is supposed to wake up whenever one or more "external processes" (as created
by RUN-PROGRAM) has unresolved termination status or pending I/O.

The watchdog process wakes up reliably, but often goes back to sleep
prematurely.  The example from the RUN-PROGRAM doc page:

(with-output-to-string (stream)
  (run-program "uname" '("-r") :output stream))

will often hang, because the watchdog process has gone back to sleep
before processing output from the external program.
watchdog-reset.diff (text/plain, 798 B)
Index: level-1/l1-boot-3.lisp
===================================================================
RCS file: /usr/local/publiccvs/ccl/level-1/l1-boot-3.lisp,v
retrieving revision 1.3
diff -u -r1.3 l1-boot-3.lisp
--- level-1/l1-boot-3.lisp	7 Aug 2002 07:46:44 -0000	1.3
+++ level-1/l1-boot-3.lisp	31 Aug 2002 05:34:40 -0000
@@ -26,12 +26,10 @@
   (process-preset *external-process-watchdog*
 		  #'(lambda ()
 		      (loop
-			(process-wait "external-process"
-				      #'(lambda ()
-					  (not (null *external-processes*))))
 			(watch-file-descriptors)
 			(check-all-pids)
-			(when (null *external-processes*)
+			(when (and (null *external-processes*)
+				   (null *watched-fd-handlers*))
 			  (process-enable-arrest-reason *current-process*))))))
 
 (catch :toplevel