ssh client sometimes hangs

Bug #349919 reported by Tony Luck
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
openssh (Ubuntu)
Fix Released
Low
Unassigned

Bug Description

$ lsb_release -rd
Description: Ubuntu 8.10
Release: 8.10
$ apt-cache policy openssh-client
openssh-client:
  Installed: 1:5.1p1-3ubuntu1
  Candidate: 1:5.1p1-3ubuntu1
  Version table:
 *** 1:5.1p1-3ubuntu1 0
        500 http://us.archive.ubuntu.com intrepid/main Packages
        100 /var/lib/dpkg/status

I have .ssh key files that I generated years ago. I copied them to ~/.ssh on my ubuntu system. Most of the time when I use ssh to run a command on another system it works fine. Once in 50 times ssh hangs locally.

This is not a network problem ... same issue happens with "localhost". E.g. if I run:

$ while :
> do ssh localhost date
> done

It will print the date a few dozen times, then the loop hangs (^C interrupts it).

I tried using strace to see what was happening. The ssh process was hung reading from a socket.
Looking back through the strace, the socket was connected to some local keyring thing.
Here are some relevent lines from strace output:

socket(PF_FILE, SOCK_STREAM, 0) = 4
fcntl(4, F_SETFD, FD_CLOEXEC) = 0
connect(4, {sa_family=AF_FILE, path="/tmp/keyring-fed2nU/ssh"}, 110) = 0
write(4, "\0\0\0\1", 4) = 4
write(4, "\v", 1) = 1
read(4, "\0\0\2h", 4) = 4
read(4, "\f\0\0\0\2\0\0\0\225\0\0\0\7ssh-rsa\0\0\0\1#\0\0\0\201"..., 616) = 616
write(3, "$K \250\310\200\247\266-\25\257\212f\226h\234\f\275a\310"..., 64) = 64
select(4, [3], NULL, NULL, NULL) = 1 (in [3])
read(3, "\34t\351\267\262/\362\315\33\r\3019\301\361dX\264\276\377"..., 8192) = 80
futex(0x7f956651f2e0, 0x81 /* FUTEX_??? */, 2147483647) = 0
futex(0x7f956651f160, 0x81 /* FUTEX_??? */, 2147483647) = 0
futex(0x7f9567385450, 0x81 /* FUTEX_??? */, 2147483647) = 0
futex(0x7f9567159590, 0x81 /* FUTEX_??? */, 2147483647) = 0
futex(0x7f95671599d0, 0x81 /* FUTEX_??? */, 2147483647) = 0

....

open("/dev/urandom", O_RDONLY) = 5
fstat(5, {st_mode=S_IFCHR|0666, st_rdev=makedev(1, 9), ...}) = 0
read(5, "\21\207y;\216\357\361\37\310\230\300\211GYpr\236a\235\t"..., 20) = 20
close(5) = 0
write(3, "\314\331H\3711\274\25\v@\201\201vG\rO\230\273d\277&8X2"..., 240) = 240
select(4, [3], NULL, NULL, NULL) = 1 (in [3])
read(3, "\234?r\352\30(\373T\277!bm\224W\30P\247\270\313\234\341"..., 8192) = 192
brk(0x7f95690d9000) = 0x7f95690d9000
brk(0x7f95690d8000) = 0x7f95690d8000
write(4, "\0\0\1\207", 4) = 4
write(4, "\r\0\0\0\225\0\0\0\7ssh-rsa\0\0\0\1#\0\0\0\201\0\300\r"..., 391) = 391
read(4, 0x7fff703fa880, 4) = ? ERESTARTSYS (To be restarted)
--- SIGINT (Interrupt) @ 0 (0) ---
+++ killed by SIGINT +++

A hung ssh process is often revived when some other outging ssh request
is initiated. Quite often the snoozy process wakes up and runs normally.
But sometimes it wakes up and reports a failed connection.

Tony Luck (tony-luck)
description: updated
Revision history for this message
Tony Luck (tony-luck) wrote :

Just upgraded to 9.04 (Jaunty Jackalope). No change in behaviour. The

while :
do ssh localhost date
done

loop still hangs periodically (and can often be unjammed by running another
"ssh somesystem ..." in another terminal window.

Revision history for this message
ZelinskiyIS (ivze) wrote :

On jaunty 9.04, i386 I experience the same bug. Sometimes, when logging out the remote shell, ssh freezes locally after saying "logout". In such cases I have to use Ctrl-C. The bug seem happen more often when tunneling graphics, than when not using this ability. The bug is not critical, however, because Ctrl-C has allways helped.

Revision history for this message
Thierry Carrez (ttx) wrote :

Can't reproduce on karmic. Please reopen if the bug is still present for you in that release.

Changed in openssh (Ubuntu):
importance: Undecided → Low
status: New → Fix Released
Revision history for this message
ZelinskiyIS (ivze) wrote :

I can confirm the bug in Karmic when logging in from a Jaunty one.
Steps:
1)>ssh -X karmicmachine
2)>gnome-system-monitor &
3)wait for gnome-system-monitor to show up and close it
4)>ps (you will see 'dbus-launch' apart from 'bash' and 'ps')
5)>exit
6)ssh hangs :(

The problem seem to be related to dbus-launch somehow, because when i kill it before typing 'exit', ssh logs out without troubles.

Revision history for this message
Tony Luck (tony-luck) wrote :

Just upgraded to 9.10 - Karmic. Agree with Thierry Carrez that bug is not reproducible on Karmic (3000 iterations of the "while :; do ssh localhost date; done" loop without a hang (8.10 and 9.04 would always hang in <100 iterations).

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.