Bug #94212 infinite loop on closing connection with ssh tunnel
Submitted: 6 Feb 2019 10:22 Modified: 28 Feb 2019 20:13
Reporter: Christian Hesse (OCA) Email Updates:
Status: Closed Impact on me:
Category:MySQL Workbench Severity:S3 (Non-critical)
Version:8.0.15 OS:Linux (Arch Linux)
Assigned to: CPU Architecture:Other (x86_64)
Tags: loop, MySQL, ssh, workbench

[6 Feb 2019 10:22] Christian Hesse
Connecting to a server with SSH (profile "Standard TCP/IP over SSH") works, but closing the connection results in an infinite loop. Log reports:

11:04:50 [ERR][SSHTunnelHandler]: Error during data transfer: unable to read, remote end disconnected
11:04:50 [ERR][SSHTunnelHandler]: Error during data transfer: unable to read, remote end disconnected

Looks like this originates from library/ssh/SSHTunnelHandler.cpp starting to line 122. Connecting strace I see these syscalls being repeaded:

[pid  1217] shutdown(21, SHUT_RDWR)     = -1 ENOTCONN (Transport endpoint is not connected)
[pid  1217] poll([{fd=21, events=POLLIN}, {fd=14, events=POLLIN}], 2, -1) = 1 ([{fd=21, revents=POLLIN|POLLHUP}])

This originates from anywhere in library/ssh/SSHTunnelManager.cpp.

Installed Arch Linux packages, system libssh is being used:

mysql-workbench 8.0.15-2
libssh 0.8.6-1

How to repeat:
Install mysql-workbench on Arch Linux, connect to a server with SSH tunnel, disconnect.

Suggested fix:
I think there are two things to fix:

* Change the code in SSHTunnelHandler.cpp to not throw an exception
* Change the code in SSHTunnelManager.cpp to not enter infinite loop after exception occurred
[6 Feb 2019 10:57] Christian Hesse
Built libssh from master branch (libssh-0.8.0-653-gc0102e6a), behaved the same.
[6 Feb 2019 14:57] Miguel Solorzano
Thank you for the bug report. Arch Linux isn't supported platform:

[12 Feb 2019 14:44] Marcin Szalowicz
Thank you for the bug report.
[28 Feb 2019 20:13] Christine Cole
Posted by developer:
Fixed as of the upcoming MySQL Workbench 8.0.16 release, and here's the changelog entry:

A successful connection made with SSH tunneling from a Linux host produced
an ongoing loop of errors if an attempt was made to close the connection.

Thank you for the bug report.