[MDEV-9149] Ctrl-C in MySQL client does not interrupt query, but interrupts the session instead Created: 2015-11-18  Updated: 2016-02-15  Resolved: 2016-02-15

Status: Closed
Project: MariaDB Server
Component/s: Scripts & Clients
Affects Version/s: 5.5, 10.0, 10.1
Fix Version/s: 10.0.24, 10.1.12

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Sergei Golubchik
Resolution: Fixed Votes: 0
Labels: upstream-fixed

Sprint: 10.0.24

 Description   

The problem is more easily visible with the debug server (the client is from the release bintar).

MariaDB [test]> create or replace table t1 (a varchar(255));
Query OK, 0 rows affected (1.13 sec)

MariaDB client

mysql  Ver 15.1 Distrib 10.1.8-MariaDB, for Linux (x86_64) using readline 5.1
 
MariaDB [test]> insert into t1 select seq_1_to_2000000;
ERROR 1054 (42S22): Unknown column 'seq_1_to_2000000' in 'field list'
MariaDB [test]> insert into t1 select * from seq_1_to_2000000;
^CCtrl-C -- sorry, cannot connect to server to kill query, giving up ...
Aborted

$ /data/releases/mariadb-10.1.8-linux-x86_64/bin/mysql -uroot --protocol=tcp  test --local-infile --port=3306 
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 4
Server version: 10.1.9-MariaDB Source distribution
 
Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.
 
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
 
MariaDB [test]> insert into t1 select * from seq_1_to_2000000;
^CCtrl-C -- sorry, cannot connect to server to kill query, giving up ...
Aborted

Check that the queries are still there:

$ /data/releases/mariadb-10.1.8-linux-x86_64/bin/mysql -uroot --protocol=tcp  test --local-infile --port=3306 
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 5
Server version: 10.1.9-MariaDB Source distribution
 
Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.
 
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
 
MariaDB [test]> show processlist;
+----+------+-----------------+------+---------+------+--------------+-----------------------------------------------+----------+
| Id | User | Host            | db   | Command | Time | State        | Info                                          | Progress |
+----+------+-----------------+------+---------+------+--------------+-----------------------------------------------+----------+
|  3 | root | localhost:45321 | test | Query   |    9 | Sending data | insert into t1 select * from seq_1_to_2000000 |    0.000 |
|  4 | root | localhost:45322 | test | Query   |    5 | Sending data | insert into t1 select * from seq_1_to_2000000 |    0.000 |
|  5 | root | localhost:45323 | test | Query   |    0 | init         | show processlist                              |    0.000 |
+----+------+-----------------+------+---------+------+--------------+-----------------------------------------------+----------+
3 rows in set (0.01 sec)

MySQL 5.6 works the same way as MariaDB, but in 5.7 it appears to be fixed:

MySQL 5.7 client

/data/releases/mysql-5.7.8-rc-linux-glibc2.5-x86_64/bin/mysql  Ver 14.14 Distrib 5.7.8-rc, for linux-glibc2.5 (x86_64) using  EditLine wrapper
 
mysql> insert into t1 select * from seq_1_to_2000000;
^C^C -- query aborted
ERROR 1317 (70100): Query execution was interrupted
mysql> insert into t1 select * from seq_1_to_2000000;
^C^C -- query aborted
ERROR 1317 (70100): Query execution was interrupted
mysql> show processlist;
+----+------+-----------------+------+---------+------+--------------+-----------------------------------------------+----------+
| Id | User | Host            | db   | Command | Time | State        | Info                                          | Progress |
+----+------+-----------------+------+---------+------+--------------+-----------------------------------------------+----------+
|  3 | root | localhost:45321 | test | Query   |   32 | Sending data | insert into t1 select * from seq_1_to_2000000 |    0.000 |
|  4 | root | localhost:45322 | test | Query   |   27 | Sending data | insert into t1 select * from seq_1_to_2000000 |    0.000 |
|  6 | root | localhost:45324 | test | Query   |    0 | init         | show processlist                              |    0.000 |
+----+------+-----------------+------+---------+------+--------------+-----------------------------------------------+----------+
3 rows in set (0.00 sec)



 Comments   
Comment by Elena Stepanova [ 2016-02-12 ]

Still reproducible.
I've set it up on perro.
login as usual;

cd mdev9149
. ./run

The script just starts the server and opens MySQL client.
After it's done, execute insert into t1 select * from seq_1_to_2000000; and press Ctrl-C after it starts running.

Comment by Sergei Golubchik [ 2016-02-12 ]

ok, --protocol=tcp was the culprit

Generated at Thu Feb 08 07:32:30 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.