Is anyone aware of a method to force termination of a single channel
without waiting for the associated process to complete?
I have a use case where my client submits several commands to be executed
over the same session at the same time on separate channels.
In some cases (cough df), one or more those commands may hang indefinitely.
I detect that the command is not finishing in a reasonable amount of time,
and now I want to tear down that process. What do I do?
- SSH2_MSG_CHANNEL_CLOSE results in a long polling loop where sshd keeps
trying to garbage collect the channel, but can't because the process is
still alive. Furthermore, this appears to be stalling the other commands
as well. (More experimentation is needed on this point.)
- SSH_MSG_DISCONNECT tears down the whole session, killing *all* the
commands. I could do this, but now I have to restart all the other
commands that get trashed.
- I could try a SSH_MSG_CHANNEL_REQUEST "signal" and send SIGINT,
SIGTERM, SIGABRT, etc, but I don't see a handler for "signal" in
the
server loop.
I've crawled the source for a few hours, but haven't come up with any
ideas more productive than the non-options above.
I could use a clue or two as to other options / how others deal with
channel timeouts.
Thanks!
- Tim.