Bug #98625 MySQL Shell 8.0.19 SOURCE command enters infinite loop
Submitted: 17 Feb 2020 3:19 Modified: 4 Mar 2020 15:19
Reporter: Jesper Wisborg Krogh Email Updates:
Status: Closed Impact on me:
None 
Category:Shell General / Core Client Severity:S2 (Serious)
Version:8.0.19 OS:Any
Assigned to: CPU Architecture:Any

[17 Feb 2020 3:19] Jesper Wisborg Krogh
Description:
Attempting to load the employees database using MySQL Shell causes MySQL Shell to execute in an infinite loop. Sometimes it is possible to terminate using CTRL+c, other times a SIGKILL is needed.

How to repeat:
1. Download the employees database from https://github.com/datacharmer/test_db and unpack it.

2. Go to the directory with employees.sql

3. In MySQL Shell using SQL mode:

mysqlsh SQL> SOURCE employees.sql
Query OK, 0 rows affected (0.0002 sec)
Query OK, 0 rows affected (0.0002 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0000 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0010 sec)
Query OK, 0 rows affected (0.0003 sec)
Query OK, 0 rows affected (0.0002 sec)
Query OK, 0 rows affected (0.0002 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0000 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected, 1 warning (0.1702 sec)
Note (code 1008): Can't drop database 'employees'; database doesn't exist
Query OK, 1 row affected (0.0058 sec)
Default schema set to `employees`.
Fetching table and column names from `employees` for auto-completion... Press ^C to stop.
+-----------------------------+
| INFO                        |
+-----------------------------+
| CREATING DATABASE STRUCTURE |
+-----------------------------+
1 row in set (0.0001 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0000 sec)
Query OK, 0 rows affected (0.0002 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0003 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0000 sec)
Query OK, 0 rows affected (0.0000 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0006 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0073 sec)
Query OK, 1 row affected (0.0056 sec)
Default schema set to `employees`.
Fetching table and column names from `employees` for auto-completion... Press ^C to stop.
+-----------------------------+
| INFO                        |
+-----------------------------+
| CREATING DATABASE STRUCTURE |
+-----------------------------+
1 row in set (0.0001 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0066 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0002 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0100 sec)
Query OK, 1 row affected (0.0380 sec)
Default schema set to `employees`.
Fetching table and column names from `employees` for auto-completion... Press ^C to stop.
+-----------------------------+
| INFO                        |
+-----------------------------+
| CREATING DATABASE STRUCTURE |
+-----------------------------+
1 row in set (0.0003 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0003 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0000 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0005 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0002 sec)
Query OK, 0 rows affected (0.0002 sec)
Query OK, 0 rows affected (0.0005 sec)
Query OK, 0 rows affected (0.0008 sec)
Query OK, 0 rows affected (0.0002 sec)
Query OK, 0 rows affected (0.0001 sec)
Query OK, 0 rows affected (0.0055 sec)
Query OK, 1 row affected (0.0069 sec)
Default schema set to `employees`.
Fetching table and column names from `employees` for auto-completion... Press ^C to stop.
...

After CTRL+c on Linux:

^C-- query aborted
Query OK, 0 rows affected (0.0345 sec)
ERROR: 1317: Query execution was interrupted
ERROR: 2006: MySQL server has gone away
ERROR: 2006: MySQL server has gone away
ERROR: 2006: MySQL server has gone away
ERROR: 2006: MySQL server has gone away
ERROR: 2006: MySQL server has gone away
ERROR: 2006: MySQL server has gone away
ERROR: 2006: MySQL server has gone away
ERROR: 2006: MySQL server has gone away
ERROR: 2006: MySQL server has gone away
ERROR: 2006: MySQL server has gone away
ERROR: 2006: MySQL server has gone away
MySQL Error 2000: Protocol errorERROR: 2006: MySQL server has gone away
ERROR: 2000: Protocol error
ERROR: 2000: Protocol error
ERROR: 2000: Protocol error
ERROR: 2000: Protocol error
...

(On Windows, MySQL Shell exits instead of printing the protocol errors.
[17 Feb 2020 5:31] MySQL Verification Team
Dear Jesper,

Thank you for the report and feedback.
Verified as described on Win10.

regards,
Umesh
[4 Mar 2020 15:19] Margaret Fisher
Posted by developer:
 
Changelog entry added for MySQL Shell 8.0.20:

When MySQL Shell's \source command was used in interactive mode to execute code from a script file, multi-line SQL statements in the script file could cause MySQL Shell to enter a loop of repeatedly executing the script. The issue has now been fixed.