Bug 1888159

Summary: ssh x11 connection is not closed when exiting gnome-terminal
Product: Red Hat Enterprise Linux 7 Reporter: Yuki Okada <yuokada>
Component: dbusAssignee: David King <dking>
Status: CLOSED WONTFIX QA Contact: Desktop QE <desktop-qa-list>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.9CC: sbarcomb, ykhutale
Target Milestone: rcKeywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-04-25 12:28:08 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Yuki Okada 2020-10-14 08:59:17 UTC
Description of problem:
- ssh x11 connection hangs (Terminal prompt does NOT return) if launching and exiting gnome-terminal via ssh x11 forwarding.
- The prompt returns only after pressing Ctrl+C.
- Last part of ssh -vvv debug log is like below. It appears some open connections remain undeleted.

  debug3: channel 4: status: The following connections are open:
    #2 x11 (t4 r4 i0/0 o0/0 fd 8/8 cc -1)
    #3 x11 (t4 r5 i0/0 o0/0 fd 9/9 cc -1)
    #4 x11 (t4 r6 i3/0 o3/0 fd 10/10 cc -1)
    #5 x11 (t4 r7 i0/0 o0/0 fd 11/11 cc -1)
  
  debug2: channel 5: rcvd adjust 33464
  debug3: send packet: type 1
  debug1: channel 2: free: x11, nchannels 3
  debug3: channel 2: status: The following connections are open:
    #2 x11 (t4 r4 i0/0 o0/0 fd 8/8 cc -1)
    #3 x11 (t4 r5 i0/0 o0/0 fd 9/9 cc -1)
    #5 x11 (t4 r7 i0/0 o0/0 fd 11/11 cc -1)
  
  debug1: channel 3: free: x11, nchannels 2
  debug3: channel 3: status: The following connections are open:
    #3 x11 (t4 r5 i0/0 o0/0 fd 9/9 cc -1)
    #5 x11 (t4 r7 i0/0 o0/0 fd 11/11 cc -1)
  
  debug1: channel 5: free: x11, nchannels 1
  debug3: channel 5: status: The following connections are open:
    #5 x11 (t4 r7 i0/0 o0/0 fd 11/11 cc -1)
  
  debug1: fd 2 clearing O_NONBLOCK
  Killed by signal 2.

Version-Release number of selected component (if applicable):
dbus-1.10.24-15.el7
openssh-7.4p1-21.el7
gnome-terminal-3.28.2-3.el7

How reproducible:
100%

Steps to Reproduce:
1. Run "ssh -X <remote hostname/ipaddress> gnome-terminal" in gnome-terminal
2. Run "exit" in gnome-terminal launched by ssh x11 forwarding
3. ssh connection hangs (The prompt does not return)

Actual results:
ssh connection hangs (prompt does NOT return)

Expected results:
ssh connection does not hang (prompt returns immediately)

Additional info:
- Similar issue was reported in BZ#1112339, and fixed in dbus-1.10.24-1.el7. But our issue occurs in dbus-1.10.24-15.el7.
- The issue is not reproduced (Prompt returns immediately) when using xterm instead of gnome-terminal like below.

  $ ssh -X <remote hostname/ipaddress> xterm

- When running "ssh -X <hostname/ip> gnome-terminal" between 2 RHEL8 servers, gnome-terminal is displayed in "remote" server (not in the "local" server where ssh -X is run). If you run the following, gnome-terminal is displayed in "local" server, and the issue is also reproducible (prompt does not return).

  $ ssh -X <remote hostname/ipaddress> 'dbus-launch --exit-with-session gnome-terminal'