Bug 76926

Summary: Exit from a ssh session may end with a dead console.
Product: [Fedora] Fedora Reporter: Ivo Sarak <ivo>
Component: opensshAssignee: Tomas Mraz <tmraz>
Severity: high Docs Contact:
Priority: medium    
Version: 2CC: namonai, twaugh
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-02-07 08:09:53 EST Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description Ivo Sarak 2002-10-29 10:47:47 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20020827

Description of problem:
If to ssh to another machine, "work" there some time and return by 'exit' will
at most cases result with dead console.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1.Go with ssh to different machine;
2.Work there for some time;
3.Type 'exit' to leave this ssh session;

Actual Results:  Console will at most cases become empty but no prompt will
appear and no keyboard input will make any difference (ctrl+c and such):


Expected Results:  Previous console prompt.

Additional info:

There is no differences between console and X - chances to get dead console is
very high.
Comment 1 Leonid Mamtchenkov 2002-10-30 08:11:29 EST
Actually, it waits for some timeout.  If you will leave console in such state
for some time (few minutes), the prompt will come back, and you will get
"expected results". :)  Sometimes it could be really annoying though.
Comment 2 Ivo Sarak 2002-10-30 09:27:51 EST
OK, I have to try it, but is it still a bug or is it intentional?

Somehow I think it is a bug.
Comment 3 Ivo Sarak 2002-11-06 14:49:49 EST
So I am waiting for this timeout - 4 hours already...
Comment 4 Ivo Sarak 2002-11-07 01:45:23 EST
I found the cause of the problem:
if user started a background program during ssh session, ssh is not capable to
exit until this background program has been terminated.

Test A:

1) ssh to a host;
2) run:
sleep 10 >/dev/null &

It takes 10 seconds to regain working console.

Test B:

1) ssh to a host;
2) run:
sleep 100 >/dev/null &

It takes 100 seconds to regain working console.

If program happens to not exit itself then there will be permanently dead console.

Comment 5 Ivo Sarak 2002-11-07 16:07:09 EST
'>/dev/null' is overkill as 'sleep' will not print out anything...
Comment 6 Ivo Sarak 2002-12-27 15:50:22 EST
I changed it over to bash as I suspect it to be source of this problem.
Comment 7 Tim Waugh 2003-01-15 05:41:28 EST
Why do you think that?  Seems like an ssh problem to me.
Comment 8 Craig Kelley 2003-10-09 12:37:13 EDT
You can also cause this to happen by logging into a RedHat server, restart cron
with something like this:

 service crond restart

then logout.  Your shell is now forever locked.
Comment 9 John Klingler 2003-10-21 20:32:06 EDT
Perhaps this problem should be renamed "background tasks hang ssh". It is very
annoying but after a while you get trained to remember to stop background tasks
before exiting. I got caught again a few minutes ago, which is why I'm here now.
However, what if you want to start a background task and exit? It still should
be fixed (or defended?) but I think severity should be normal or low.
Comment 10 Ivo Sarak 2004-06-24 09:52:21 EDT
Just to remind - the issue is still here even with FC2.
Comment 11 Darryl Dixon 2004-06-28 17:40:13 EDT
It's not only background tasks - I can replicate this problem
precisely every time if I wish.  In the cases that I have seen it
relates to receiving certain output onto the ssh console while
working.  If I then try to exit it will hang.  Either ssh receives a
bad character that it "doesn't like" or it receives something to
stdout/stderr that it doesn't like - perhaps a program leaving one of
these open?  Either way, it isn't just background tasks :(
Comment 12 Ken Snider 2004-12-07 12:33:57 EST
This is a known issue in the openssh faq:


basically, ssh can't close its FDs if a subprocess still has
Comment 13 Tomas Mraz 2005-02-07 08:09:53 EST

*** This bug has been marked as a duplicate of 39128 ***