scsh-users
[Top] [All Lists]

wait-any bug on Solaris (scsh 0.5.0)

To: scsh-bugs@martigny.ai.mit.edu
Subject: wait-any bug on Solaris (scsh 0.5.0)
From: Glenn Ammons <ammons@cs.wisc.edu>
Date: 01 May 1997 20:45:51 -0500
On SunOS 5.5.1, wait-any doesn't return any process objects until all
children have died.  The following script demonstrates the bug


(define (fork-sleep n)
  (let ((proc (&  (sleep ,n))))
    (display (format #f "~a started." (proc:pid proc)))
    (newline)))

(fork-sleep 1)
(fork-sleep 2)
(fork-sleep 4)
(fork-sleep 8)
(fork-sleep 16)

(define (wait-all)
  (receive (proc status) (wait-any)
           (if proc
               (begin
                 (display (format #f "~a exited with status ~a."
                                  (proc:pid proc) status))
                 (newline)
                 (wait-all)))))

(wait-all)


The exited messages are displayed all at once after about 16 seconds
instead of at intervals.  I trussed scsh, and it looks like the
waitpid's return as expected.  Here's the last bit of the truss output:


...
waitid(P_ALL, 0, 0xEFFFF628, WEXITED|WTRAPPED)  Err#4 EINTR
setcontext(0xEFFFF310)
waitid(P_ALL, 0, 0xEFFFF628, WEXITED|WTRAPPED)  = 0
    Received signal #18, SIGCLD, in waitid() [caught]
      siginfo: SIGCLD CLD_EXITED pid=20169 status=0x0000
waitid(P_ALL, 0, 0xEFFFF628, WEXITED|WTRAPPED)  Err#4 EINTR
setcontext(0xEFFFF310)
waitid(P_ALL, 0, 0xEFFFF628, WEXITED|WTRAPPED)  = 0
waitid(P_ALL, 0, 0xEFFFF628, WEXITED|WTRAPPED) (sleeping...)
    Received signal #18, SIGCLD, in waitid() [caught]
      siginfo: SIGCLD CLD_EXITED pid=20170 status=0x0000
waitid(P_ALL, 0, 0xEFFFF628, WEXITED|WTRAPPED)  Err#4 EINTR
setcontext(0xEFFFF310)
waitid(P_ALL, 0, 0xEFFFF628, WEXITED|WTRAPPED)  = 0
waitid(P_ALL, 0, 0xEFFFF628, WEXITED|WTRAPPED) (sleeping...)
    Received signal #18, SIGCLD, in waitid() [caught]
      siginfo: SIGCLD CLD_EXITED pid=20171 status=0x0000
waitid(P_ALL, 0, 0xEFFFF628, WEXITED|WTRAPPED)  Err#4 EINTR
setcontext(0xEFFFF310)
waitid(P_ALL, 0, 0xEFFFF628, WEXITED|WTRAPPED)  = 0
waitid(P_ALL, 0, 0xEFFFF628, WEXITED|WTRAPPED) (sleeping...)
    Received signal #18, SIGCLD, in waitid() [caught]
      siginfo: SIGCLD CLD_EXITED pid=20172 status=0x0000
waitid(P_ALL, 0, 0xEFFFF628, WEXITED|WTRAPPED)  Err#4 EINTR
setcontext(0xEFFFF310)
waitid(P_ALL, 0, 0xEFFFF628, WEXITED|WTRAPPED)  = 0
waitid(P_ALL, 0, 0xEFFFF628, WEXITED|WTRAPPED)  Err#10 ECHILD
waitid(P_ALL, 0, 0xEFFFF628, WEXITED|WTRAPPED)  Err#10 ECHILD
20172 exited with status 0.
write(1, " 2 0 1 7 2   e x i t e d".., 28)      = 28
20171 exited with status 0.
write(1, " 2 0 1 7 1   e x i t e d".., 28)      = 28
20170 exited with status 0.
write(1, " 2 0 1 7 0   e x i t e d".., 28)      = 28
20169 exited with status 0.
write(1, " 2 0 1 6 9   e x i t e d".., 28)      = 28
20168 exited with status 0.
write(1, " 2 0 1 6 8   e x i t e d".., 28)      = 28
waitid(P_ALL, 0, 0xEFFFF628, WEXITED|WTRAPPED)  Err#10 ECHILD
lseek(0, 0, SEEK_CUR)                           = 73380
_exit(0)


--glenn

<Prev in Thread] Current Thread [Next in Thread>
  • wait-any bug on Solaris (scsh 0.5.0), Glenn Ammons <=