Skip to content

Using wantReply on an ChannelSignalMessage can lead to deadlock #110

@cmbrose

Description

@cmbrose

In both the C# and TS implementations, the ChannelSignalMessage explicitly sets wantReply to false before sending:

However, this change is done while the message is being written to binary, after the SshChannel checks the value:

if (!request.wantReply) {

This means that if you set wantReply on the message, the SshChannel will wait for a response which will never come, because it wasn't actually asked for.

This is easy to reproduce:

const signalMessage = new ChannelSignalMessage();
signalMessage.signal = 'INT';
signalMessage.wantReply = true;

// get a channel...

const res = await channel.request(signalMessage); // Deadlock!

There's no comment on the line that overrides the wantReply value so I'm not sure the purpose of it - reading the OpenSSH source it seems like wantReply is valid for a signal message and would be handled.

If this is intentional, it would probably just be best to remove the wantReply property from the ChannelSignalMessage. Otherwise, it would be good to remove the override.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions