Skip to content

EOF sent for already closed channel #1584

Open
ploxiln/paramiko-ng
#82

Description

@bentsi

For some reason (probably related to #1115) paramiko sends EOF for an already closed Channel, causing the Transport to close the whole SSH session.

paramiko log

2019-12-26 23:10:06,019 f:channel.py   p:DEBUG > [chan 8129] Max packet in: 32768 bytes
2019-12-26 23:10:07,014 f:channel.py   p:DEBUG > [chan 8129] Max packet out: 32768 bytes
2019-12-26 23:10:08,050 f:channel.py   p:DEBUG > [chan 8129] Sesch channel 8129 request ok
2019-12-26 23:10:08,085 f:channel.py   p:DEBUG > [chan 8129] EOF received (8129)
2019-12-26 23:10:08,087 f:channel.py   p:DEBUG > [chan 8129] EOF sent (8129)
2019-12-26 23:10:08,692 f:transport.py p:INFO  > Disconnect (code 2): Received ieof for nonexistent channel 11.

SSHD log

Dec 26 23:10:06 ip-10-0-109-19 sshd[1936]: debug1: server_input_channel_open: ctype session rchan 8129 win 2097152 max 32768
Dec 26 23:10:06 ip-10-0-109-19 sshd[1936]: debug1: input_session_request
Dec 26 23:10:06 ip-10-0-109-19 sshd[1936]: debug1: channel 11: new [server-session]
Dec 26 23:10:06 ip-10-0-109-19 sshd[1936]: debug1: session_new: session 11
Dec 26 23:10:06 ip-10-0-109-19 sshd[1936]: debug1: session_open: channel 11
Dec 26 23:10:06 ip-10-0-109-19 sshd[1936]: debug1: session_open: session 11: link with channel 11
Dec 26 23:10:06 ip-10-0-109-19 sshd[1936]: debug1: server_input_channel_open: confirm session
Dec 26 23:10:07 ip-10-0-109-19 sshd[1936]: debug1: server_input_channel_req: channel 11 request exec reply 1
Dec 26 23:10:07 ip-10-0-109-19 sshd[1936]: debug1: session_by_channel: session 11 channel 11
Dec 26 23:10:07 ip-10-0-109-19 sshd[1936]: debug1: session_input_channel_req: session 11 req exec
Dec 26 23:10:07 ip-10-0-109-19 sshd[1936]: Starting session: command for centos from 10.0.226.244 port 51038 id 11
Dec 26 23:10:07 ip-10-0-109-19 sshd[1933]: debug1: session_new: session 11
Dec 26 23:10:07 ip-10-0-109-19 sshd[1936]: debug1: Received SIGCHLD.
Dec 26 23:10:07 ip-10-0-109-19 sshd[1936]: debug1: session_by_pid: pid 22847
Dec 26 23:10:07 ip-10-0-109-19 sshd[1936]: debug1: session_exit_message: session 11 channel 11 pid 22847
Dec 26 23:10:07 ip-10-0-109-19 sshd[1936]: debug1: session_exit_message: release channel 11
Dec 26 23:10:08 ip-10-0-109-19 sshd[1936]: debug1: session_by_channel: session 11 channel 11
Dec 26 23:10:08 ip-10-0-109-19 sshd[1936]: debug1: session_close_by_channel: channel 11 child 0
Dec 26 23:10:08 ip-10-0-109-19 sshd[1936]: Close session: user centos from 10.0.226.244 port 51038 id 11
Dec 26 23:10:08 ip-10-0-109-19 sshd[1936]: debug1: channel 11: free: server-session, nchannels 12
Dec 26 23:10:08 ip-10-0-109-19 sshd[1936]: channel_by_id: 11: bad id: channel free
Dec 26 23:10:08 ip-10-0-109-19 sshd[1936]: Disconnecting: Received ieof for nonexistent channel 11.
Dec 26 23:10:08 ip-10-0-109-19 sshd[1936]: debug1: do_cleanup
Dec 26 23:10:08 ip-10-0-109-19 sshd[1933]: debug1: do_cleanup
Dec 26 23:10:08 ip-10-0-109-19 sshd[1933]: debug1: PAM: cleanup
Dec 26 23:10:08 ip-10-0-109-19 sshd[1933]: debug1: PAM: closing session
Dec 26 23:10:08 ip-10-0-109-19 sshd[1933]: pam_unix(sshd:session): session closed for user centos
Dec 26 23:10:08 ip-10-0-109-19 sshd[1933]: debug1: PAM: deleting credentials
Dec 26 23:10:13 ip-10-0-109-19 sshd[1915]: debug1: Forked child 22859.
Dec 26 23:10:13 ip-10-0-109-19 sshd[22859]: debug1: Set /proc/self/oom_score_adj to 0
Dec 26 23:10:13 ip-10-0-109-19 sshd[22859]: debug1: rexec start in 5 out 5 newsock 5 pipe 7 sock 8
Dec 26 23:10:13 ip-10-0-109-19 sshd[22859]: debug1: inetd sockets after dupping: 3, 3
Dec 26 23:10:13 ip-10-0-109-19 sshd[22859]: Connection from 10.0.226.244 port 37794 on 10.0.109.19 port 22

When used in fabric this behavior causes fabric connection to stop waiting for other processes that are run via other channels and exit them with return code -1.

Activity

  1. markhuangext359 commented on Jun 8, 2020

    @markhuangext359

    The workaround works for me:

    • downgrade paramiko to 2.5.1
      or
    • comment out this line
  2. added 2 commits that reference this issue on Jun 12, 2020
    73151b4
    2608d90
  3. added a commit that references this issue on Jul 29, 2020
    413ec61
  4. ploxiln commented on Jul 29, 2020

    @ploxiln
    Contributor

    see also #1705

  5. mykaul commented on Jan 4, 2023

    @mykaul

    Does #1822 help solve this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions