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
The ultimate problem is a general one concerning ChannelExecs:
If
there is a communication protocol implemented between the client and the remote command via the stdin/stdout streams,
and if the protocol is such that the remote command can return an error code in this application protocol,
and the client uses the default inverted output stream to read that error code,
and the client then decides to close the channel (even gracefully),
then it is possible that the AbstractClientChannel's out stream is closed between lines 436 and 437, and then the flush()call on the ChannelPipedOutputStream may fail, causing the whole session to go down.
This can happen in the ScpTestat line 343, which tests an scp upload command that should fail. The scp server sends back an ERROR ack, which the client reads (on an I/O thread) and forwards in AbstractClientChannel. The client reads this though the ChannelPipedInputStream (on the main thread) and throws an exception, which then causes the channel to be closed at the end of DefaultScpClient.runUpload() (still on the main thread). Only then does the I/O thread call flush(), which then fails with an exception.
So in short we have
I/O thread: receive data
I/O thread: write data to ChannelPipedOutputStream
Main thread: read data from ChannelPipedInputStream
Main thread: close channel
I/O thread: call ChannelPipedOutputStream.flush() and fail.
This is all the more infuriating since ChannelPipedOutputStream.flush() is essentially a no-op. Moreover: an exception when a channel has received data and tries to forward it should not take down the whole session but only this channel.
The text was updated successfully, but these errors were encountered:
ChannelPipedOutputStream passes on data immediately to its sink.
Flushing such a stream is thus a no-op, and must not throw an
exception even when the stream is already closed. Otherwise there
may be spurious failures if the reader of the sink decides to
close the whole channel before the channel has flushed the
ChannelPipedOutputStream.
Fixesapache#266.
Bug: apache#266
The ultimate problem is a general one concerning ChannelExecs:
If
then it is possible that the
AbstractClientChannel
'sout
stream is closed between lines 436 and 437, and then theflush()
call on theChannelPipedOutputStream
may fail, causing the whole session to go down.This can happen in the
ScpTest
at line 343, which tests an scp upload command that should fail. The scp server sends back an ERROR ack, which the client reads (on an I/O thread) and forwards inAbstractClientChannel
. The client reads this though theChannelPipedInputStream
(on the main thread) and throws an exception, which then causes the channel to be closed at the end ofDefaultScpClient.runUpload()
(still on the main thread). Only then does the I/O thread callflush()
, which then fails with an exception.So in short we have
ChannelPipedOutputStream
ChannelPipedInputStream
ChannelPipedOutputStream.flush()
and fail.This is all the more infuriating since
ChannelPipedOutputStream.flush()
is essentially a no-op. Moreover: an exception when a channel has received data and tries to forward it should not take down the whole session but only this channel.The text was updated successfully, but these errors were encountered: