-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
bugIssue is reported as a bugIssue is reported as a bugpriority:lowteam:PSAssigned to OTP team PSAssigned to OTP team PS
Description
Describe the bug
A match error is sometimes raised in ssh_sftp:write_file when the SSH connection or channel is closed by a separate process.
To Reproduce
Sorry about the Elixir repro code.
{:ok, channel} = :ssh_sftp.start_channel(ssh)
spawn(fn ->
Process.sleep(50)
:ssh_sftp.stop_channel(channel)
end)
spawn(fn ->
:ssh_sftp.write_file(channel, '/tmp/foo', "bar")
end)
The timing matters.
- With a shorter sleep, write_file returns
{error, closed}
. - With a longer sleep, it returns
ok
. - With just the right sleep, it raises
{badmatch, {error, closed}}
on line 1079 of ssh_sftp.erl.
Expected behavior
I would expect it to return {error, closed}
if the connection/channel becomes closed before the operation completes.
Affected versions
27
Additional context
I suspect that ssh_sftp:read_file has a similar problem. It looks like the actual match error is in the do_handle_call for send_window, and recv_window is almost identical.
Metadata
Metadata
Assignees
Labels
bugIssue is reported as a bugIssue is reported as a bugpriority:lowteam:PSAssigned to OTP team PSAssigned to OTP team PS