[MDEV-5323] Ctrl-C not working under Ubuntu Created: 2013-11-20  Updated: 2014-01-30  Resolved: 2013-12-12

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: 5.1.67, 5.2.14, 5.3.12, 5.5.34, 10.0.6
Fix Version/s: 5.5.35, 10.0.7

Type: Bug Priority: Minor
Reporter: vsespb Assignee: Sergei Golubchik
Resolution: Fixed Votes: 0
Labels: client
Environment:

Ubuntu 12.04


Attachments: File conf.tar.gz    

 Description   

If I run mysql client, run lang query (like select * from table) and press Ctrl-C - nothing happens, I have to wait till query finish (even several minutes).

Tried in different virtual terminals.

Mysqlclient worked fine, before I upgraded to mariadb.

mariadb-client:
  Installed: 5.5.33a+maria-1~precise
  Candidate: 5.5.33a+maria-1~precise
  Version table:
 *** 5.5.33a+maria-1~precise 0
       1000 http://mariadb.cu.be//repo/5.5/ubuntu/ precise/main amd64 Packages
        100 /var/lib/dpkg/status



 Comments   
Comment by vsespb [ 2013-11-21 ]

same in
====
Installed: 5.5.34+maria-1~precise
Candidate: 5.5.34+maria-1~precise
Version table:

Comment by Elena Stepanova [ 2013-11-28 ]

Works all right for me:

MariaDB [db]> insert into t1 select * from t1;
Query OK, 2097152 rows affected (22.14 sec)
Records: 2097152 Duplicates: 0 Warnings: 0

MariaDB [db]> select * from t1;
^CCtrl-C – query killed. Continuing normally.
ERROR 1317 (70100): Query execution was interrupted
MariaDB [db]>

elenst@ubuntu12-04:~$ which mysql
/usr/bin/mysql
elenst@ubuntu12-04:~$ dpkg -S /usr/bin/mysql
mariadb-client-core-5.5: /usr/bin/mysql

elenst@ubuntu12-04:~$ dpkg -l mariadb-client-core-5.5
...
ii mariadb-client-core-5.5 5.5.34+maria-1~precise MariaDB database core client binaries

Please attach your cnf files and provide the table definition (show create table), the number of rows in the table and the real query, I will give it another try with the additional data.
Thanks.

Comment by vsespb [ 2013-11-29 ]

attaching configs ( /etc/mysql )

Comment by vsespb [ 2013-11-29 ]

use test;
drop table if exists t1;
create table t1 (f1 int(11));
insert into t1 set f1=42;
 
 
insert into t1 select * from t1;  [[ ran 18 times ]]
 
select * from t1;
[[pressed Ctrl-C, but not interrupted, no effect at all]]
262144 rows in set (0.10 sec)
 
MariaDB [test]> select * from t1;
[[I did not press Ctrl-C here]]
ERROR 1317 (70100): Query execution was interrupted

Comment by vsespb [ 2013-11-30 ]

some more info:
1)

same effect if I open another terminal and run

kill -s INT 24350
(24350 is PID of mysql client)

during query execution: query not terminated, next query terminated.

so it's not related to keyboard, GUI, terminals etc. something with signal handler.

2)
issue is reproducible if ran as root unix user and non-root unix user.
issue is reproducible if ran as root mysql user and non-root mysql user.

3) issue persists after reboot.

Comment by Elena Stepanova [ 2013-12-02 ]

I think I figured the missing point.

There are two important stages of executing a query, easily distinguishable on the client side:
1) the query is being processed by the server, nothing is happening in the client, the query is kind of "hanging";
2) the server is returning result set, the client starts printing it.

When you are saying that Ctrl-C does not work, do you mean the second stage, when the result set rows already started appearing in the client?

Comment by vsespb [ 2013-12-02 ]

> 2) the server is returning result set, the client starts printing it.
exactly, stage (2)

Comment by Elena Stepanova [ 2013-12-02 ]

The difference between MariaDB and MySQL behavior is visible on the following conditions:

  • the client is connected to the server through the socket;
  • the interruption occurs when the client has already started producing the result set.

MySQL client aborts the output immediately, saying

42
42

^C| 42 |
Ctrl-C – sending "KILL QUERY 52" to server ...
Ctrl-C – query aborted.
------
262144 rows in set (2.10 sec)

The next query fails with
mysql> select * from t1;
ERROR 1317 (70100): Query execution was interrupted

The next query works as usual.

MariaDB client does not do anything until the query is finished:

42
42
42

------
262144 rows in set (2.09 sec)

The next query fails with
MariaDB [test]> select * from t1;
ERROR 1317 (70100): Query execution was interrupted

The next query works as usual.

MySQL behavior is better in comparison, I would also want to be able to interrupt the undesirable output.
It would be even better if the next query didn't inherit the interruption, but maybe it's too difficult to do.

Comment by Daniel Bartholomew [ 2014-01-29 ]

http://bazaar.launchpad.net/~maria-captains/maria/5.5/revision/3999

Comment by vsespb [ 2014-01-30 ]

main issue seems fixed in 5.5.35+maria-1~precise
however seems there is still a problem.

after query terminated with Ctrl-C, next query is failed.

|    2545589 |
|    2545590 |
|    2545592 |
|    2545593 |
|    2545595 ||    2545595 |
Ctrl-C -- query killed. Continuing normally.
^C
+------------+
383850 rows in set (0.27 sec)
 
MariaDB [xxx]> select service_id from services;
ERROR 1317 (70100): Query execution was interrupted

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