You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Race conditions between creating and sending messages #1115
I get a lot of "Received ieof for nonexistent channel" messages sent from openSSH server when connecting as paramiko client. These messages are due to an EOF being sent after already closing the channel it is sent on. It results in the entire transport being shutdown.
The root cause is a race condition when closing a connection and a shutdown_write in Channel:
shutdown_write close
------ -----
lock()
m = create EOF msg
unlock()
lock()
internal_close
m1 = create shutdown msg # (None because already created)
m2 = close message
unlock()
send m1, m2 # (None, close)
send m # (EOF)
By putting an extra lock around the close, shutdown, _request_failed, and _handle_close I don't see the issue anymore. However, I think it is still possible to have race conditions between send and close (create a message to send, then close is interleaved, then send the send message).
However, it seems like there was a good reason that locks like that didn't exist in the first place what ideas do you have for fixing the race condition?
Hi, I have been using paramiko-ng but it currently don't support Jammy Jellyfish due to rsa-sha2-256 and rsa-sha2-512 change. I want to switch back to paramiko but this bug is still causing failures.
Is there a way to pull in the changes in ploxiln#101 to paramiko?
Thanks
Looks like #1137 was the original inspiration for the work in ploxiln#101.
@DavidQing, bitprophet is in the middle of modernizing the key/auth systems (see #387#23), which will be occupying much of his paramiko time for a while, spanning the next couple of minor releases.
This seems like something of great enough a magnitude that it will have to wait until after the key/auth work is done. So, it will likely be some months before this can be addressed. The fact that #1137 is available will hopefully speed this one up.
Keep an eye on this issue for activity; and, if you have any additional information about the details of the race condition, please add them to the thread here.
Hi all, apologies for the slow reply. No updates, unfortunately, bitprophet has been in a prolonged run with time to spare only for significant security fixes.
Thank you for posting to indicate that the issue is still relevant, it will help prioritize when the time comes.
Activity
Fix race condition where messages can be sent after `Channel.close`.
channel: lock around transport send of eof and channel close
channel: lock around transport send of eof and channel close
channel: fix race between sending channel EOF and CLOSE messages
channel: fix race between sending channel EOF and CLOSE messages
DavidQing commentedon Jun 15, 2023
Hi, I have been using paramiko-ng but it currently don't support Jammy Jellyfish due to rsa-sha2-256 and rsa-sha2-512 change. I want to switch back to paramiko but this bug is still causing failures.
Is there a way to pull in the changes in ploxiln#101 to paramiko?
Thanks
bskinn commentedon Jun 25, 2023
Looks like #1137 was the original inspiration for the work in ploxiln#101.
@DavidQing, bitprophet is in the middle of modernizing the key/auth systems (see #387 #23), which will be occupying much of his
paramikotime for a while, spanning the next couple of minor releases.This seems like something of great enough a magnitude that it will have to wait until after the key/auth work is done. So, it will likely be some months before this can be addressed. The fact that #1137 is available will hopefully speed this one up.
Keep an eye on this issue for activity; and, if you have any additional information about the details of the race condition, please add them to the thread here.
sdodsley commentedon Dec 19, 2023
@bskinn any news on when this will be resolved?
nmorad commentedon Jan 20, 2025
@bskinn Any updates on this bug?
AlonMarko commentedon Nov 3, 2025
@bskinn
is there an update on this bug atm?
bskinn commentedon Nov 3, 2025
Hi all, apologies for the slow reply. No updates, unfortunately, bitprophet has been in a prolonged run with time to spare only for significant security fixes.
Thank you for posting to indicate that the issue is still relevant, it will help prioritize when the time comes.
channel/transport: fix EOF-after-CLOSE race by gating sends under sen…