remote: Do not leave client hanging on unhandled proto message (#36590)

Otherwise the client will wait for a response that never arrives,
causing the task to lock up

Release Notes:

- N/A
This commit is contained in:
Lukas Wirth 2025-08-20 15:41:58 +02:00 committed by GitHub
parent bc79076ad3
commit c5040bd0a4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2353,6 +2353,7 @@ impl ChannelClient {
build_typed_envelope(peer_id, Instant::now(), incoming) build_typed_envelope(peer_id, Instant::now(), incoming)
{ {
let type_name = envelope.payload_type_name(); let type_name = envelope.payload_type_name();
let message_id = envelope.message_id();
if let Some(future) = ProtoMessageHandlerSet::handle_message( if let Some(future) = ProtoMessageHandlerSet::handle_message(
&this.message_handlers, &this.message_handlers,
envelope, envelope,
@ -2391,6 +2392,15 @@ impl ChannelClient {
.detach() .detach()
} else { } else {
log::error!("{}:unhandled ssh message name:{type_name}", this.name); log::error!("{}:unhandled ssh message name:{type_name}", this.name);
if let Err(e) = AnyProtoClient::from(this.clone()).send_response(
message_id,
anyhow::anyhow!("no handler registered for {type_name}").to_proto(),
) {
log::error!(
"{}:error sending error response for {type_name}:{e:#}",
this.name
);
}
} }
} }
} }