Bug #32457 mysqladmin 32-bit clients fail to kill 64-bit server threads
Submitted: 16 Nov 2007 18:36 Modified: 18 Jun 2009 15:03
Reporter: Domas Mituzas Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:5.1-bk, 5.0-bk, 4.1-bk, 4.0-bk OS:Any (32-bit OS)
Assigned to: Jim Winstead CPU Architecture:Any

[16 Nov 2007 18:36] Domas Mituzas
Description:
mysql_kill() pid argument on 32-bit platforms is 32-bit ulong. 
It makes it impossible to use mysql_kill() and 'mysqladmin kill' 32-bit clients to kill connections, that have pid>2^31, like this one:

mysql> show full processlist \G
*************************** 1. row ***************************
     Id: 4199205518
   User: myuser
   Host: 10.0.2.91:47815
     db: NULL
Command: Sleep
   Time: 2
  State: 
   Info: NULL
*************************** 2. row ***************************

How to repeat:
$ mysqladmin kill 5444333222
mysqladmin: kill failed on 2147483647; error: 'Unknown thread id: 2147483647'

Suggested fix:
Use 64-bit integer types as arguments:

libmysql.c:

int STDCALL
mysql_kill(MYSQL *mysql,ulong pid)

mysqladmin.cc:

         if (mysql_kill(mysql,(ulong) atol(pos)))
          {
            my_printf_error(0, "kill failed on %ld; error: '%s'", error_flags,
                            atol(pos), mysql_error(mysql));
            error=1;
          }
[16 Nov 2007 18:37] Domas Mituzas
^^ above code snippets are current code, not suggested fix
[7 May 2009 20:11] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/73612

2889 Jim Winstead	2009-05-07
      mysqladmin kill can't handle 64-bit thread IDs. (Bug #32457)
      modified:
        client/mysqladmin.cc
[7 May 2009 20:15] Jim Winstead
mysqladmin kill can avoid the limitations of mysql_kill() by generating the KILL statement itself.

The API issue was opened as a new bug, Bug #44728.
[13 May 2009 16:08] Jim Winstead
Patch queued to 5.1-bugteam, will be merged up from there.
[28 May 2009 8:20] Bugs System
Pushed into 5.1.36 (revid:joro@sun.com-20090528073639-yohsb4q1jzg7ycws) (version source revid:jimw@mysql.com-20090512212719-mjc8fz4q3ewvr4yd) (merge vers: 5.1.35) (pib:6)
[30 May 2009 2:13] Paul DuBois
Noted in 5.1.36 changelog.

mysqladmin kill did not work for thread IDs larger than 32 bits.

Setting report to NDI pending push into 6.0.x.
[17 Jun 2009 19:26] Bugs System
Pushed into 5.4.4-alpha (revid:alik@sun.com-20090616183122-chjzbaa30qopdra9) (version source revid:jimw@mysql.com-20090514020104-7u5cqf5cyywa8aks) (merge vers: 6.0.12-alpha) (pib:11)
[18 Jun 2009 15:03] Paul DuBois
Noted in 5.4.4 changelog.
[12 Aug 2009 22:59] Paul DuBois
Noted in 5.4.2 changelog because next 5.4 version will be 5.4.2 and not 5.4.4.
[15 Aug 2009 2:17] Paul DuBois
Ignore previous comment about 5.4.2.
[26 Aug 2009 13:46] Bugs System
Pushed into 5.1.37-ndb-7.0.8 (revid:jonas@mysql.com-20090826132541-yablppc59e3yb54l) (version source revid:jonas@mysql.com-20090826132541-yablppc59e3yb54l) (merge vers: 5.1.37-ndb-7.0.8) (pib:11)
[26 Aug 2009 13:46] Bugs System
Pushed into 5.1.37-ndb-6.3.27 (revid:jonas@mysql.com-20090826105955-bkj027t47gfbamnc) (version source revid:jonas@mysql.com-20090826105955-bkj027t47gfbamnc) (merge vers: 5.1.37-ndb-6.3.27) (pib:11)
[26 Aug 2009 13:48] Bugs System
Pushed into 5.1.37-ndb-6.2.19 (revid:jonas@mysql.com-20090825194404-37rtosk049t9koc4) (version source revid:jonas@mysql.com-20090825194404-37rtosk049t9koc4) (merge vers: 5.1.37-ndb-6.2.19) (pib:11)
[27 Aug 2009 16:33] Bugs System
Pushed into 5.1.35-ndb-7.1.0 (revid:magnus.blaudd@sun.com-20090827163030-6o3kk6r2oua159hr) (version source revid:jonas@mysql.com-20090826132541-yablppc59e3yb54l) (merge vers: 5.1.37-ndb-7.0.8) (pib:11)
[9 Oct 2009 1:28] Paul DuBois
The 5.4 fix has been pushed to 5.4.2.