Problem while exiting sftp on SX-6...

Manish Kumar Srivastava, Noida
Mon, 30 Dec 2002 12:49:53 -0000

Hi,

I am trying to run sftp on SX-6 and it is giving me problem when
I try to exit from sftp. On pressing ^D or entering "bye" on
sftp prompt, sftp hangs. And I have to press ^C to quit.

The versions are: -
1. openssh-3.1p1 on both client and server.
2. Both client (sftp) and server (sshd) are running on SX-6

It appears that the client and server are hanging on "select".
I am appending the debug messages below. The same problem is
repeated if I run server of SX-6 and client on P-II running on
Red Hat 7.1 and openssh-3.1p1.

---------------------------------------------------------------------
Server Side: -

# ./sshd -d -p 12020 -f /usr/local/etc/sshd_config
debug1: sshd version OpenSSH_3.1p1
debug1: private host key: #0 type 0 RSA1
debug1: read PEM private key done: type RSA
debug1: private host key: #1 type 1 RSA
debug1: read PEM private key done: type DSA
debug1: private host key: #2 type 2 DSA
debug1: Bind to port 12020 on 0.0.0.0.
Server listening on 0.0.0.0 port 12020.
Generating 768 bit RSA key.
RSA key generation complete.
debug1: Server will not fork when running in debugging mode.
Connection from 204.160.252.25 port 3892
debug1: Client protocol version 2.0; client software version OpenSSH_3.1p1
debug1: match: OpenSSH_3.1p1 pat OpenSSH*
Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-1.99-OpenSSH_3.1p1
debug1: list_hostkey_types: ssh-rsa,ssh-dss
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: client->server 3des-cbc hmac-md5 none
debug1: kex: server->client 3des-cbc hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST received
debug1: SSH2_MSG_KEX_DH_GEX_GROUP sent
debug1: dh_gen_key: priv key bits set: 202/384
debug1: bits set: 1995/4095
debug1: expecting SSH2_MSG_KEX_DH_GEX_INIT
debug1: bits set: 2039/4095
debug1: SSH2_MSG_KEX_DH_GEX_REPLY sent
debug1: kex_derive_keys
debug1: newkeys: mode 1
debug1: SSH2_MSG_NEWKEYS sent
debug1: waiting for SSH2_MSG_NEWKEYS
debug1: newkeys: mode 0
debug1: SSH2_MSG_NEWKEYS received
debug1: KEX done
debug1: userauth-request for user perl service ssh-connection method none
debug1: attempt 0 failures 0
Failed none for perl from 204.160.252.25 port 3892 ssh2
debug1: userauth-request for user perl service ssh-connection method
keyboard-interactive
debug1: attempt 1 failures 1
debug1: keyboard-interactive devs
debug1: auth2_challenge: user=perl devsdebug1: kbdint_alloc: devices ''
Failed keyboard-interactive for perl from 204.160.252.25 port 3892 ssh2
debug1: userauth-request for user perl service ssh-connection method
password
debug1: attempt 2 failures 2
Accepted password for perl from 204.160.252.25 port 3892 ssh2
debug1: Entering interactive session for SSH2.
debug1: fd 3 setting O_NONBLOCK
debug1: fd 7 setting O_NONBLOCK
debug1: server_init_dispatch_20
debug1: mks wait_until_can_do_something before select
debug1: mks wait_until_can_do_something after select
debug1: server_input_channel_open: ctype session rchan 0 win 131072 max
32768
debug1: input_session_request
debug1: channel 0: new [server-session]
debug1: session_new: init
debug1: session_new: session 0
debug1: session_open: channel 0
debug1: session_open: session 0: link with channel 0
debug1: server_input_channel_open: confirm session
debug1: mks wait_until_can_do_something before select
debug1: mks wait_until_can_do_something after select
debug1: mks wait_until_can_do_something before select
debug1: mks wait_until_can_do_something after select
debug1: server_input_channel_req: channel 0 request subsystem reply 1
debug1: session_by_channel: session 0 channel 0
debug1: session_input_channel_req: session 0 req subsystem
subsystem request for sftp
debug1: subsystem: exec() /usr/local/libexec/sftp-server
debug1: fd 9 setting O_NONBLOCK
debug1: mks wait_until_can_do_something before select
debug1: mks wait_until_can_do_something after select
debug1: mks wait_until_can_do_something before select
debug1: mks wait_until_can_do_something after select
debug1: mks wait_until_can_do_something before select
debug1: mks wait_until_can_do_something after select
debug1: mks wait_until_can_do_something before select
debug1: mks wait_until_can_do_something after select
debug1: mks wait_until_can_do_something before select
debug1: mks wait_until_can_do_something after select
debug1: mks wait_until_can_do_something before select
debug1: mks wait_until_can_do_something after select
debug1: mks wait_until_can_do_something before select
debug1: mks wait_until_can_do_something after select
debug1: mks wait_until_can_do_something before select
debug1: mks wait_until_can_do_something after select
debug1: mks wait_until_can_do_something before select
debug1: mks wait_until_can_do_something after select
debug1: mks wait_until_can_do_something before select
debug1: mks wait_until_can_do_something after select
debug1: channel 0: rcvd eof
debug1: channel 0: output open -> drain
debug1: channel 0: obuf empty
debug1: channel 0: close_write
debug1: channel 0: output drain -> closed
debug1: mks wait_until_can_do_something before select
...[It hangs here, I pressed ^C on client side] <------------------------
hangs
debug1: mks wait_until_can_do_something after select
Connection closed by remote host.
debug1: channel_free: channel 0: server-session, nchannels 1
debug1: Received SIGCHLD.
debug1: session_close: session 0 pid 9679
Closing connection to 204.160.252.25
---------------------------------------------------------------------

Client side (I pressed ^C on client side): -

$ ./sftp -oPort=12020 -oLogLevel=DEBUG3 perl at sx6ihcl
Connecting to sx6ihcl...
debug1: Reading configuration data /usr/local/etc/ssh_config
debug3: Seeing PRNG from /usr/local/libexec/ssh-rand-helper
debug1: Rhosts Authentication disabled, originating port will not be
trusted.
debug1: restore_uid
debug1: ssh_connect: getuid 106 geteuid 106 anon 1
debug1: Connecting to sx6ihcl [204.160.252.25] port 12020.
debug1: temporarily_use_uid: 106/102 (e=106)
debug1: restore_uid
debug1: temporarily_use_uid: 106/102 (e=106)
debug1: restore_uid
debug1: Connection established.
debug1: identity file /home/perl/.ssh/id_rsa type -1
debug1: identity file /home/perl/.ssh/id_dsa type -1
debug1: Remote protocol version 1.99, remote software version OpenSSH_3.1p1
debug1: match: OpenSSH_3.1p1 pat OpenSSH*
Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_3.1p1
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug2: kex_parse_kexinit:
diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-rsa,ssh-dss
debug2: kex_parse_kexinit:
aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc
debug2: kex_parse_kexinit:
aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc
debug2: kex_parse_kexinit:
hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160 at openssh.com,hmac-sha1-96,hm
ac-md5-96
debug2: kex_parse_kexinit:
hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160 at openssh.com,hmac-sha1-96,hm
ac-md5-96
debug2: kex_parse_kexinit: none
debug2: kex_parse_kexinit: none
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: kex_parse_kexinit:
diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-rsa,ssh-dss
debug2: kex_parse_kexinit:
3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc
debug2: kex_parse_kexinit:
3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc
debug2: kex_parse_kexinit:
hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160 at openssh.com,hmac-sha1-96,hm
ac-md5-96
debug2: kex_parse_kexinit:
hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160 at openssh.com,hmac-sha1-96,hm
ac-md5-96
debug2: kex_parse_kexinit: none,zlib
debug2: kex_parse_kexinit: none,zlib
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: mac_init: found hmac-md5
debug1: kex: server->client 3des-cbc hmac-md5 none
debug2: mac_init: found hmac-md5
debug1: kex: client->server 3des-cbc hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: dh_gen_key: priv key bits set: 180/384
debug1: bits set: 2039/4095
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug3: check_host_in_hostfile: filename /home/perl/.ssh/known_hosts
debug3: check_host_in_hostfile: match line 2
debug3: check_host_in_hostfile: filename /home/perl/.ssh/known_hosts
debug3: check_host_in_hostfile: match line 2
debug1: Host 'sx6ihcl' is known and matches the RSA host key.
debug1: Found key in /home/perl/.ssh/known_hosts:2
debug1: bits set: 1995/4095
debug1: ssh_rsa_verify: signature correct
debug1: kex_derive_keys
debug1: newkeys: mode 1
debug1: SSH2_MSG_NEWKEYS sent
debug1: waiting for SSH2_MSG_NEWKEYS
debug1: newkeys: mode 0
debug1: SSH2_MSG_NEWKEYS received
debug1: done: ssh_kex2.
debug1: send SSH2_MSG_SERVICE_REQUEST
debug1: service_accept: ssh-userauth
debug1: got SSH2_MSG_SERVICE_ACCEPT
debug1: authentications that can continue:
publickey,password,keyboard-interactive
debug3: start over, passed a different list
publickey,password,keyboard-interactive debug3: preferred
publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: next auth method to try is publickey
debug1: try privkey: /home/perl/.ssh/id_rsa
debug3: no such identity: /home/perl/.ssh/id_rsa
debug1: try privkey: /home/perl/.ssh/id_dsa
debug3: no such identity: /home/perl/.ssh/id_dsa
debug2: we did not send a packet, disable method
debug3: authmethod_lookup keyboard-interactive
debug3: remaining preferred: password
debug3: authmethod_is_enabled keyboard-interactive
debug1: next auth method to try is keyboard-interactive
debug2: userauth_kbdint
debug2: we sent a keyboard-interactive packet, wait for reply
debug1: authentications that can continue:
publickey,password,keyboard-interactive
debug3: userauth_kbdint: disable: no info_req_seen
debug2: we did not send a packet, disable method
debug3: authmethod_lookup password
debug3: remaining preferred:
debug3: authmethod_is_enabled password
debug1: next auth method to try is password
perl at sx6ihcl's password:
debug1: packet_send2: adding 64 (len 53 padlen 11 extra_pad 64)
debug2: we sent a password packet, wait for reply
debug1: ssh-userauth2 successful: method password
debug1: fd 4 setting O_NONBLOCK
debug2: fd 5 is O_NONBLOCK
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug1: send channel open 0
debug1: Entering interactive session.
debug1: mks client_wait_until_can_do_something before select statement
debug1: mks client_wait_until_can_do_something after select statement
debug1: mks client_wait_until_can_do_something before select statement
debug1: mks client_wait_until_can_do_something after select statement
debug2: callback start
debug1: ssh_session2_setup: id 0
debug1: Sending subsystem: sftp
debug1: channel request 0: subsystem
debug2: callback done
debug1: channel 0: open confirm rwindow 0 rmax 32768
debug1: mks client_wait_until_can_do_something before select statement
debug1: mks client_wait_until_can_do_something after select statement
debug1: mks client_wait_until_can_do_something before select statement
debug1: mks client_wait_until_can_do_something after select statement
debug2: channel 0: rcvd adjust 131072
debug1: mks client_wait_until_can_do_something before select statement
debug1: mks client_wait_until_can_do_something after select statement
debug1: mks client_wait_until_can_do_something before select statement
debug1: mks client_wait_until_can_do_something after select statement
debug1: mks client_wait_until_can_do_something before select statement
debug1: mks client_wait_until_can_do_something after select statement
debug1: mks client_wait_until_can_do_something before select statement
debug1: mks client_wait_until_can_do_something after select statement
debug1: mks client_wait_until_can_do_something before select statement
debug1: mks client_wait_until_can_do_something after select statement
debug1: mks client_wait_until_can_do_something before select statement
debug1: mks client_wait_until_can_do_something after select statement
debug1: mks client_wait_until_can_do_something before select statement
debug1: mks client_wait_until_can_do_something after select statement
debug1: mks client_wait_until_can_do_something before select statement
debug1: mks client_wait_until_can_do_something after select statement
debug1: mks client_wait_until_can_do_something before select statementsftp>
bye
debug1: mks client_wait_until_can_do_something after select statement
debug1: channel 0: read<=0 rfd 4 len 0
debug1: channel 0: read failed
debug1: channel 0: close_read
debug1: mks channel 0: input open -> drain
debug1: channel 0: ibuf empty
debug1: channel 0: send eof
debug1: mks channel 0: input drain -> closed
debug1: mks client_wait_until_can_do_something before select statement
debug1: mks client_wait_until_can_do_something after select statement
debug1: mks client_wait_until_can_do_something before select statement
... [It hangs here, I pressed ^C]
<---------------------------------------------hangs
debug1: mks client_wait_until_can_do_something inside if select statement
debug1: channel_free: channel 0: client-session, nchannels 1
debug3: channel_free: status: The following connections are open:
  #0 client-session (t4 r0 i3/0 o0/0 fd -1/5)

debug3: channel_close_fds: channel 0: r -1 w 5 e 6
debug1: fd 0 clearing O_NONBLOCK
debug2: fd 1 is not O_NONBLOCK
Killed by signal 2.
debug1: Calling cleanup 0x40004db98(0x0)
debug1: Calling cleanup 0x40009a218(0x0)
---------------------------------------------------------------------

Kindly suggest, what could be the problem? I tried changing the timeval
values for select at the client side (basically setting tv_sec to 1
and tv_usec to 0) but its apparently of no use.

Thanks & Regards

Manish