Bug 251566 - konsole hangs for a while after closing a tab which initially executed autossh
Summary: konsole hangs for a while after closing a tab which initially executed autossh
Status: RESOLVED FIXED
Alias: None
Product: konsole
Classification: Applications
Component: general (show other bugs)
Version: 2.4.3
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords:
: 254600 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-09-17 14:24 UTC by Nils Hügelmann
Modified: 2011-10-03 04:54 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.8


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nils Hügelmann 2010-09-17 14:24:10 UTC
Version:           2.4.3 (using KDE 4.4.4) 
OS:                Linux

konsole -e autossh -M 0:7 root@localhost
(open new tab or window)
(try to close one of the tabs via the konsole menu)
->crash

i was only able to recreate the problem with autossh...

Reproducible: Always




OS: Linux (i686) release 2.6.34-12-desktop
Compiler: gcc
Comment 1 Nils Hügelmann 2010-09-17 21:55:17 UTC
crash is inaccurate, all konsole windows show no more reaction
Comment 2 Shlomi Fish 2010-11-08 22:31:38 UTC
Here with Mandriva Linux Cooker on a Pentium 4 (x86-32) and konsole from kdebase4-4.5.74-0.svn1190490.1mdv2011.0.src.rpm , then konsole hangs for a while after I try to close a tab and then becomes responsive again. It's still a bug, though.
Comment 3 Jekyll Wu 2011-07-17 05:32:16 UTC
I can reproduce this with 2.7.999, kind of.

konsole does not crash. konsole(the whole app) hangs for a while(1 minute or so), then it resumes and the tab/session you have asked to close is still open and alive.

If 'Ctrl+D' is pressed to finish the ssh connection established by autossh, that tab will be closed normally.

So I guess the thing is when konsole menu is used to close tab , autossh does not think its job is done and won't die. Mabye it thinks the ssh connectio is broken and reestablishes the ssh connection ,as its name implies?

This bug may be related with #185140, where konsole does not kill the terminal process properly, either.
Comment 4 Jekyll Wu 2011-07-31 20:46:10 UTC
I got a clue why konsole hangs for a while.

First, when user asks to close the session through menu, konsole will send SIGHUP to the terminal process(in this report, autossh).

Second, most terminal processes will die when SIGHUP is received, but autossh does not. According to autossh(1), `autossh can be "prodded" to retry by signalling it, perhaps with SIGHUP ("kill -HUP").`

Third, konsole will wait for the terminal process to die by calling QProcess::waitForFinished(). Normally, that would return quickly. But since autossh does not die, that method will block until the default timeout, 30s, is reached. That is where the hang is introduced.

I will try to make a nice patch and post it on reviewboard sometime later.
Comment 5 Jekyll Wu 2011-08-02 04:24:17 UTC
*** Bug 254600 has been marked as a duplicate of this bug. ***
Comment 6 Jekyll Wu 2011-10-03 04:54:01 UTC
Git commit e3a09c9c4d7a35d458440e28501098f3ac13b684 by Jekyll Wu.
Committed on 03/10/2011 at 05:01.
Pushed by jekyllwu into branch 'master'.

Close session reliably when the session process doesn't die with SIGHUP.

BUG:241709
BUG:251566
CCBUG:254600
FIXED-IN: 4.8
REVIEW:102239

M  +1    -1    src/MainWindow.cpp
M  +41   -18   src/Session.cpp
M  +20   -5    src/Session.h
M  +41   -3    src/SessionController.cpp
M  +8    -2    src/SessionController.h
M  +2    -2    src/ViewManager.cpp

http://commits.kde.org/konsole/e3a09c9c4d7a35d458440e28501098f3ac13b684