Bug 251351

Summary: konsole freezes when a shell is hanging because of broken ssh connection
Product: [Applications] konsole Reporter: meyerm
Component: generalAssignee: Konsole Developer <konsole-devel>
Status: NEEDSINFO WAITINGFORINFO    
Severity: normal CC: ach, adaptee, aspotashev, auxsvr, dion, eggert, justin.zobel, kde, kde, kde_bugs, kedadi, kevin.kofler, luke-jr+kdebugs, martijn.saelens, mbriza, nikoli, phma, rgom.debian
Priority: HI    
Version: 16.08.3   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In:

Description meyerm 2010-09-15 18:38:54 UTC
Version:           2.4.5 (using KDE 4.4.5) 
OS:                Linux

I mounted some directories via sshfs onto my local system and navigate through them with konsole having several tabs opened. But when my connection breaks (beeing online with 3G/UMTS) the shell hangs, of course. This includes all programs having a file on this share opened.

But when such a shell hangs, I can no longer interact with konsole. Including switching tabs or creating a new tab to get a new local shell.

Reproducible: Always

Steps to Reproduce:
1. open konsole
2. mount remote directory (f.ex. with sshfs)
3. navigate into this directory with several shells and open a file
4. slow the connection down / break it

Actual Results:  
5. konsole is non-responsive
6. open a new konsole process / switch to console and kill sshfs
7. be able to use the first konsole window again

Expected Results:  
5. konsole stays repsonsive and only the shells within hang

OS: Linux (x86_64) release 2.6.34-gentoo-r1
Compiler: x86_64-pc-linux-gnu-gcc
Comment 1 Kurt Hindenburg 2011-03-04 19:48:20 UTC
*** Bug 252232 has been marked as a duplicate of this bug. ***
Comment 2 Jekyll Wu 2011-07-19 06:58:22 UTC
possibly a duplicate of #256301
Comment 3 Kurt Hindenburg 2011-07-19 10:53:55 UTC
*** Bug 256301 has been marked as a duplicate of this bug. ***
Comment 4 Jekyll Wu 2011-08-03 08:00:57 UTC
*** Bug 185817 has been marked as a duplicate of this bug. ***
Comment 5 Jekyll Wu 2011-09-20 15:41:35 UTC
*** Bug 177077 has been marked as a duplicate of this bug. ***
Comment 6 phma 2012-01-26 01:35:10 UTC
I've seen this happen without ssh, but haven't figured out how to reproduce it. Latest time it happened, I typed "ls" in one konsole and switched to another virtual desktop. I got a truss trace (BSD equivalent of strace) in another konsole, running as another user, where I am su'ed to root:

lseek(20,0x3000,0)                               = 12288 (0x3000)
read(0x14,0x2a31f000,0x1000)                     = 4096 (0x1000)
lseek(20,0x1000,0)                               = 4096 (0x1000)
read(0x14,0x2a31b000,0x1000)                     = 4096 (0x1000)
close(20)                                        = 0 (0x0)
munmap(0x2ce9c000,0x4000)                        = 0 (0x0)
__sysctl(0xbfbfe540,0x4,0xbfbbe540,0xbfbfe558,0x0,0x0) = 0 (0x0)
__sysctl(0xbfbfe548,0x4,0x0,0xbfbfe55c,0x0,0x0)  = 0 (0x0)
__sysctl(0xbfbfe548,0x4,0x2a0ec240,0xbfbfe55c,0x0,0x0) = 0 (0x0)
mmap(0x0,16384,0x3,0x1002,-1,0x0)                = 753516544 (0x2ce9c000)
stat("/etc/nsswitch.conf",0xbfbfe388)            = 0 (0x0)
geteuid()                                        = 1021 (0x3fd)
stat("/etc/pwd.db",0xbfbfe168)                   = 0 (0x0)
open("/etc/pwd.db",0x0,00)                       = 20 (0x14)
fcntl(0x14,0x2,0x1)                              = 0 (0x0)
read(0x14,0x2ef91160,0x104)                      = 260 (0x104)
lseek(20,0x6000,0)                               = 24576 (0x6000)
read(0x14,0x2a319000,0x1000)                     = 4096 (0x1000)
lseek(20,0x4000,0)                               = 16384 (0x4000)
read(0x14,0x2a31b000,0x1000)                     = 4096 (0x1000)
lseek(20,0x5000,0)                               = 20480 (0x5000)
read(0x14,0x2a31d000,0x1000)                     = 4096 (0x1000)
lseek(20,0x7000,0)                               = 28672 (0x7000)
read(0x14,0x2a316000,0x1000)                     = 4096 (0x1000)
lseek(20,0x8000,0)                               = 32768 (0x8000)
read(0x14,0x2a314000,0x1000)                     = 4096 (0x1000)
lseek(20,0xd000,0)                               = 53248 (0xd000)
read(0x14,0x2f8a1000,0x1000)                     = 4096 (0x1000)
lseek(20,0x2000,0)                               = 8192 (0x2000)
read(0x14,0x2a312000,0x1000)                     = 4096 (0x1000)
lseek(20,0x3000,0)                               = 12288 (0x3000)
read(0x14,0x2a31f000,0x1000)                     = 4096 (0x1000)
lseek(20,0x1000,0)                               = 4096 (0x1000)
read(0x14,0x2a31c000,0x1000)                     = 4096 (0x1000)
close(20)                                        = 0 (0x0)
munmap(0x2ce9c000,0x4000)                        = 0 (0x0)
__sysctl(0xbfbfe540,0x4,0xbfbbe540,0xbfbfe558,0x0,0x0) = 0 (0x0)
__sysctl(0xbfbfe548,0x4,0x0,0xbfbfe55c,0x0,0x0)  = 0 (0x0)
__sysctl(0xbfbfe548,0x4,0x2a0ec240,0xbfbfe55c,0x0,0x0) = 0 (0x0)
mmap(0x0,16384,0x3,0x1002,-1,0x0)                = 753516544 (0x2ce9c000)
stat("/etc/nsswitch.conf",0xbfbfe388)            = 0 (0x0)
geteuid()                                        = 1021 (0x3fd)
stat("/etc/pwd.db",0xbfbfe168)                   = 0 (0x0)
open("/etc/pwd.db",0x0,00)                       = 20 (0x14)
fcntl(0x14,0x2,0x1)                              = 0 (0x0)

Moving nsswitch.conf had no effect other than changing the output of the stat command. Sending konsole an ALRM signal results in its death.

DragonFly v2.11.0.681.g0eed2f-DEVELOPMENT
Konsole 2.5.4
KDE 4.5.5
Comment 7 Jekyll Wu 2012-03-27 20:30:52 UTC
*** Bug 296903 has been marked as a duplicate of this bug. ***
Comment 8 Jekyll Wu 2012-04-16 18:27:37 UTC
*** Bug 297899 has been marked as a duplicate of this bug. ***
Comment 9 Jekyll Wu 2012-04-29 05:55:04 UTC
*** Bug 279133 has been marked as a duplicate of this bug. ***
Comment 10 Kurt Hindenburg 2012-06-18 13:02:15 UTC
Git commit 1ce424142f1ee31a25cbb9398c79df9d98d81d71 by Kurt Hindenburg.
Committed on 18/06/2012 at 14:56.
Pushed by hindenburg into branch 'master'.

Use readlink instead of QFileInfo to prevent non-responsive issues.

The current code using QFileInfo on the /proc/%pid/cwd and for some
situations, this may cause issues as QFileInfo hangs if unable to read that
file.  The new code uses readlink which appears to work w/o issue.

The Solaris  code needs fixed as well.

M  +16   -12   src/ProcessInfo.cpp

http://commits.kde.org/konsole/1ce424142f1ee31a25cbb9398c79df9d98d81d71
Comment 11 Martin Bříza 2012-07-17 11:15:51 UTC
This bug was also reported in the Red Hat Bugzilla for Fedora 16 on https://bugzilla.redhat.com/show_bug.cgi?id=794974 .
Comment 12 Anguo 2017-01-29 06:38:48 UTC
This bug still exists on the latest gentoo packages.
If the ssh connection is lost, we cannot input anything in the konsole tab. 
If waiting long enough (a couple of hours?), then some timeout appears to kick in and a message "connection lost" is displayed and only then can we type anything (e.g. type 'exit' to close the tab).
Comment 13 Anguo 2017-01-29 06:46:06 UTC
How to reproduce:
https://bugs.kde.org/show_bug.cgi?id=185466#c2

2) ssh to a server in one tab (lets say tab A)
3) Disconnect the connection abruptly (turn off the wireless/network)
4) Now the tab A will be frozen, no keys will work (it should be a bug i think). But the right click context menu will work !
5) Close tab A. A confirmation dialog box with a warning message will appear "The program 'ssh' is currently running in this session.  Are you sure you want to close it?"
Comment 14 Anguo 2017-01-29 06:59:36 UTC
After about one hour of the tab with the  ssh process being frozen, this was output: 
 packet_write_wait: Connection to nnn.nnn.nnn.nnn port nnnn: Broken pipe
and control was restored.

Why would the ssh be broken (broken pipe) in the first place?
Comment 15 Justin Zobel 2020-11-03 06:08:09 UTC
This is still an issue on git master.

I can't even kill the konsole process with ksysguard.
Comment 16 martijn.saelens 2022-04-22 14:45:02 UTC
This issue still exists on Konsole 21.12.2.
Comment 17 Kurt Hindenburg 2024-03-24 01:45:17 UTC
let us know if you still have this issue on a recent version
Comment 18 Bug Janitor Service 2024-04-08 03:47:23 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 19 martijn.saelens 2024-04-08 23:03:50 UTC
Problem still persists on Konsole 24.02.1:

1. Log in using SSH
2. Kill the connection
3. Although Konsole is active, the terminal itself is not available for new commands. The only way to be able to further use the Konsole window is by creating a new tab and killing the SSH tab.