| Bug #31222 | com_% global status counters behave randomly with mysql_change_user | ||
|---|---|---|---|
| Submitted: | 27 Sep 2007 8:26 | Modified: | 14 Mar 3:11 |
| Reporter: | Shane Bester | ||
| Status: | Closed | ||
| Category: | Server: General | Severity: | S3 (Non-critical) |
| Version: | 5.0.50, 5.1.23 | OS: | Any |
| Assigned to: | Alexander Nozdrin | Target Version: | 5.0+ |
| Tags: | mysql_change_user | ||
| Triage: | D2 (Serious) | ||
[27 Sep 2007 8:26]
Shane Bester
[27 Sep 2007 8:34]
Shane Bester
evidence of memory corruption:
mysql> call p1('select now()');
ERROR 1054 (42S22): Unknown column 'R☻.root.☻' in 'field list'
mysql>
[27 Sep 2007 8:45]
Shane Bester
using rainbow's queries as a parameter to this proc1 caused the error after a few thousand. need to try repeat it reliably.
Attachment: proc1.sql (application/octet-stream, text), 297 bytes.
[27 Sep 2007 9:21]
Shane Bester
I now suspect the cause of the problem is mysql_change_user call. after removing those from my application, the counters looks correct again.
[27 Sep 2007 11:45]
Shane Bester
testcase to show mysql_change_user messes up global variables.
Attachment: bug31222.php (application/octet-stream, text), 1.23 KiB.
[27 Sep 2007 11:48]
Shane Bester
ok, I uploaded a php testcase to show how com_select is affected by mysql_change_user. I
think the memory corruptions can be a different problem afterall. Sorry for the mess
here.
E:\wrk\bugs\bug31222>php bug31222.php
global status before select:
Array
(
[0] => Com_select
[Variable_name] => Com_select
[1] => 0
[Value] => 0
)
now running 100 selects
..........................................................................................
..........
global status after select:
Array
(
[0] => Com_select
[Variable_name] => Com_select
[1] => 100
[Value] => 100
)
about to change user
global status after change user:
Array
(
[0] => Com_select
[Variable_name] => Com_select
[1] => 0
[Value] => 0 <-----what happened to the hundred selects??
)
[12 Feb 18:56]
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/42123 ChangeSet@1.2546, 2008-02-12 20:59:09+03:00, anozdrin@quad. +3 -0 Fix for Bug#31222: com_% global status counters behave randomly with mysql_change_user. The problem was that global status variables were not updated in THD::check_user(), so thread statistics were lost after COM_CHANGE_USER. The fix is to update global status variables with the thread ones before preparing the thread for new user.
[12 Feb 18:59]
Alexander Nozdrin
Pushed into 5.1-runtime.
[12 Feb 19:39]
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/42131 ChangeSet@1.2547, 2008-02-12 21:42:15+03:00, anozdrin@quad. +1 -0 Additional fix for Bug#31222.
[13 Feb 10:57]
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/42198 ChangeSet@1.2550, 2008-02-13 13:00:24+03:00, anozdrin@quad. +5 -0 Additional patch for Bug#31222: com_% global status counters behave randomly with mysql_change_user. The test case had to be moved into not_embedded_server.test file, because SHOW GLOBAL STATUS does not work properly in embedded server (see bug 34517).
[3 Mar 19:19]
Bugs System
Pushed into 5.1.24-rc
[3 Mar 19:19]
Bugs System
Pushed into 6.0.5-alpha
[14 Mar 3:11]
Paul DuBois
Noted in 5.1.24, 6.0.5 changelogs. The mysql_change_user() C API function caused global Com_xxx status variable values to be incorrect.
[30 Mar 21:55]
Jon Stephens
Also documented fix for 5.1.23-ndb-6.3.11.
