I've been building a system that runs (without a tty, if that makes a difference) in the background on a Linux system, and which, in turn runs a series of processes. It's in a fairly normal shell script pipeline and exists for the purpose of multi-threading this one step of the pipeline.
All seems to be well running interactively. However, when the process runs as a gsi-script, it blocks inside ##thread-sleep! in ##process- status. The final result is the script running at 100% of the CPU (polling the port, seemingly) with a dangling child process, which has already exitted (exat?) and is now a zombie.
It seems as though once this happens, each remaining open-process port will block until the full timeout of process-status is reached.
the most relevant functions are here:
(define (throw-shell-error port timeout) (or (zero? (process-status port timeout 100)) (error "fg command failed")) (close-port port))
(define (bg cmd . arguments) (open-process (list path: cmd arguments: arguments)))
(define (fg cmd . arguments) (let ((proc (open-process (list path: cmd arguments: arguments)))) (throw-shell-error proc *join-timeout*)))
I am running these commands purely for side-effects, and not reading from or writing to their ports.
The problem appears to have something to do with load -- I can run a large number of low impact commands, and a much smaller number of "convert" (from the ImageMagick tools) commands before the zombie processes begin to block my execution.
So, as I'm investigating: am I using these commands in the fashion intended by the author? I believe that they are correct in the sense of indicating the programs I mean to run, but am I misusing the port metaphor in some fashion? Any help would be appreciated.
For a bit I had each process represented by a gambit thread, but I'm currently just mapping over collections of ports.
Gambit v4.0.0, Linux 2.6.17.3 running under gsi-script, same behavior with and without -:d. I haven't used other options to gsi-script.
Afficher les réponses par date
On 5-Sep-07, at 6:15 PM, Lang Martin wrote:
All seems to be well running interactively. However, when the process runs as a gsi-script, it blocks inside ##thread-sleep! in ##process- status. The final result is the script running at 100% of the CPU (polling the port, seemingly) with a dangling child process, which has already exitted (exat?) and is now a zombie.
It seems as though once this happens, each remaining open-process port will block until the full timeout of process-status is reached.
To debug this problem I suggest you add a trace in function sigchld_signal_handler in lib/os_io.c. What interests me is the values returned by the call to waitpid . I suspect the status in neither WIFEXITED(status) or WIFSIGNALED(status), so the process is never marked as terminated. Another problem might be that a SIGCHLD signal is never generated for the process.
Marc
On Sep 6, 2007, at 8:06 AM, Marc Feeley wrote:
To debug this problem I suggest you add a trace in function sigchld_signal_handler in lib/os_io.c. What interests me is the values returned by the call to waitpid .
I have not had a chance to try this yet, however, it seems as though the problem may have gone away with a transition from 4.0.0 --inline- jumps --single-host to 4.0.1 --single-host. Does that shed any light on the problem?
I suspect the status in neither WIFEXITED(status) or WIFSIGNALED (status), so the process is never marked as terminated. Another problem might be that a SIGCHLD signal is never generated for the process.
Am I correct that both of these suggestions presume that the child process exits improperly? the child process for this program is "convert" from the imagemagick suite, and the program runs properly in scsh.
I'm sorry this account is so sloppy, I will return to this problem at some point in the future (when I have more time) and try to figure it out. In the meantime, think of this as more of a "brain-dump in case it's useful" than a "bug report".
Lang