Bug #73914 mysqladmin does not terminate properly - even when mysqld process is fully gone
Submitted: 14 Sep 2014 21:02 Modified: 15 Sep 2014 8:10
Reporter: Roel Van de Paar Email Updates:
Status: Verified Impact on me:
Category:MySQL Server: Command-line Clients Severity:S2 (Serious)
Version:5.6.20, 5.6.22, 5.7.6 OS:Any
Assigned to: CPU Architecture:Any
Tags: debug builds

[14 Sep 2014 21:02] Roel Van de Paar
See bug #73913 for a testcase (pre-patch of that bug)

In the testcase of bug #73913 it uses the ./stop script (listed there) which will try and shutdown the server using the mysqladmin command.

However, mysqladmin will effectively not halt/terminate, even though core file generation by mysqld seems to complete (i.e. the core file is readable by gdb) and mysqld is gone (ps -ef | grep mysqld gives no mysqld results).

So, there is a bug in mysqladmin here - which only seems to show on this particular testcase (and possibly others; I may have noticed mysqladmin termination failures before).

mysqladmin in this case does not terminate after mysqld is done writing the coredump and exiting. 

If bug #73913 is resolved, it would likely mean that mysqld will stop properly, and that this bug in mysqladmin would be masked [once again].

mysqladmin should terminate when mysqld process is gone. Even waiting for 10-20+ minutes makes no difference and mysqladmin remains active:

[roel@localhost mysql-5.6.20-linux-x86_64-debug]$ ps -ef | grep mysqld | grep -v "grep"
[roel@localhost mysql-5.6.20-linux-x86_64-debug]$ ps -ef | grep mysqladmin | grep -v "grep"
roel      3118  3117  0 16:46 pts/1    00:00:00 /sda/mysql-5.6.20-linux-x86_64-debug/bin/mysqladmin -uroot -S/sda/mysql-5.6.20-linux-x86_64-debug/socket.sock shutdown

The issue is consistently reproducible.

How to repeat:
Use testcase from #73913 on a debug build (please rename mysqld-debug to mysqld to match testcase if required) prior to any fixes/patches for that bug.

Suggested fix:
Please make mysqladmin terminate properly.

It would be great to see this bug in mysqladmin fixed for QA purposes also - as it causes the testcase reduction program reducer.sh to "hang" in an previously unseen/unknown state!
[14 Sep 2014 21:50] Roel Van de Paar
Have now confirmed seen this on another statement also (hard to analyze which one as it's a long SQL trace, but clear it's happening), so the issue is not limited to SET GLOBAL INNODB_PURGE_STOP_NOW=ON;
[14 Sep 2014 22:09] Roel Van de Paar
As a sidenote, a workaround was added to reducer.sh for this as follows;

-  $MYBASE/bin/mysqladmin -uroot -S$WORKD/socket.sock shutdown >> $WORKD/mysqld.out 2>&1
+  # RV-15/9/14 Added timeout due to bug http://bugs.mysql.com/bug.php?id=73914
+  timeout -k20 -s9 20s $MYBASE/bin/mysqladmin -uroot -S$WORKD/socket.sock shutdown >> $WORKD/mysqld.out 2>&1
[15 Sep 2014 8:10] MySQL Verification Team
Hello Roel,

Thank you for the bug report and test case.
5.6/5.7 seems to be affected, mysqld-debug process was down but mysqladmin hanged for long( waited 12-15min each time and later Ctr+C manually to end the session).

[15 Sep 2014 8:11] MySQL Verification Team
Related Bug #73913