Bug #99911 SSH tunnel is not closed.
Submitted: 17 Jun 2020 10:38 Modified: 7 Aug 2020 7:47
Reporter: Lee Kevin Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Workbench Severity:S2 (Serious)
Version:8.0.20 OS:Linux (Ubuntu 18.04 x86_64)
Assigned to: CPU Architecture:Any
Tags: WBBugReporter

[17 Jun 2020 10:38] Lee Kevin
Description:
----[For better reports, please attach the log file after submitting. You can find it in /home/highvolt/.mysql/workbench/log/wb.log]

I am sorry my poor English.

A ssh tunneling is not closed when I tested the ssh connection by 'Test Connection' button in Manager Server Connections dialog. So, a number of ssh tunneling is increased as number of clicking the 'Test Connection' button.

You can see 3 lines in following netstat log when I tested 3 times. 3 lines of "sshd: root" are the ssh tunnels.  

root@skminvm:~# netstat -anp
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      486/mysqld          
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      419/systemd-resolve 
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      454/sshd            
tcp        0      0 127.0.0.1:40162         127.0.0.1:3306          TIME_WAIT   -                   
tcp        0      0 127.0.0.1:40160         127.0.0.1:3306          TIME_WAIT   -                   
tcp        0      0 127.0.0.1:40164         127.0.0.1:3306          TIME_WAIT   -                   
tcp        0      0 10.0.2.15:22            121.157.229.24:53306    ESTABLISHED 3819/sshd: root     
tcp        0    196 10.0.2.15:22            121.157.229.24:42358    ESTABLISHED 2091/sshd: root@pts 
tcp        0      0 10.0.2.15:22            121.157.229.24:53244    ESTABLISHED 3779/sshd: root     
tcp        0      0 10.0.2.15:22            121.157.229.24:53190    ESTABLISHED 3739/sshd: root     
tcp6       0      0 :::443                  :::*                    LISTEN      800/apache2         
tcp6       0      0 127.0.0.1:8005          :::*                    LISTEN      587/java            
tcp6       0      0 :::8009                 :::*                    LISTEN      587/java            
tcp6       0      0 :::80                   :::*                    LISTEN      800/apache2         
tcp6       0      0 :::8080                 :::*                    LISTEN      587/java            
tcp6       0      0 :::4949                 :::*                    LISTEN      488/perl            
tcp6       0      0 :::22                   :::*                    LISTEN      454/sshd            
udp        0      0 127.0.0.53:53           0.0.0.0:*                           419/systemd-resolve 
udp        0      0 10.0.2.15:68            0.0.0.0:*                           269/systemd-network 

These ssh tunnels are closed only when I close MySQL Workbench. Therefore, useless ssh tunnel connections are generated whenever I test ssh tunnel connection.

How to repeat:
1. Open 'Manage Server Connections'.
2. Set configurations for SSH tunneling.
3. Click 'Test Connection'
4. You can see success message.
5. Login ssh to the host server.
6. run 'netstat -anp'
7. You can see established ssh tunnel connection which should be closed.

Suggested fix:
After testing connection, the ssh tunnel should be closed regardless of termination of MySQL workbench.
[17 Jun 2020 10:40] Lee Kevin
wb.log file

Attachment: wb.log (text/x-log), 11.31 KiB.

[7 Aug 2020 7:47] MySQL Verification Team
Hello Lee Kevin,

Thank you for the bug report.
Verified as described.

Regards
Ashwini Patil
[27 Jul 2023 11:48] MySQL Verification Team
Bug #111889 marked as duplicate of this one.