Bug #26938 SHOW PROFILE: hangs if @@profiling not set to 1
Submitted: 7 Mar 2007 22:53 Modified: 6 Jul 2007 3:14
Reporter: Paul Dubois Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.37 OS:Linux (Linux, Mac OS X)
Assigned to: Chad MILLER CPU Architecture:Any
Tags: profiling, show profile

[7 Mar 2007 22:53] Paul Dubois
Description:
SHOW PROFILE hangs if executed before enabling the
@@profiling session variable.  For example, it hangs
if it is the first statement executed.

How to repeat:
% mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 5.0.37-debug-log Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> SHOW PROFILE;

At this point, the statement hangs, and has to be killed

Query aborted by Ctrl+C
Aborted

The hang also occurs if you execute "SET @@profiling = 0"
prior to "SHOW PROFILE".

% mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 17
Server version: 5.0.37-debug-log Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> SET @@profiling = 0;
Query OK, 0 rows affected (0.00 sec)

mysql> SHOW PROFILE;
Query aborted by Ctrl+C
Aborted

The hang does NOT occur if @@profiling has been enabled
prior to "SET PROFILE", even if the variable is disabled when
"SET PROFILE" is executed.

% mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 19
Server version: 5.0.37-debug-log Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> SET @@profiling = 1;
Query OK, 0 rows affected (0.00 sec)

mysql> SET @@profiling = 0;
Query OK, 0 rows affected (0.00 sec)

mysql> SHOW PROFILE;
+----------------+------------+
| Status         | Duration   |
+----------------+------------+
| Opening tables | 0.00004400 | 
+----------------+------------+
1 row in set (0.00 sec)

So perhaps it is some kind of variable initialization problem.
[7 Mar 2007 23:13] Giuseppe Maxia
Thanks for your bug report.
Verified as described on Linux and Mac OS X.
[8 Mar 2007 17:55] Chad MILLER
Hrm.  One must send the fields or send an error.
[22 Jun 2007 10:50] 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/29375

ChangeSet@1.2472, 2007-06-22 06:46:41-04:00, cmiller@zippy.cornsilk.net +8 -0
  Unify profiling SHOW code and INFORMATION_SCHEMA code for
  profiling.  Also,
  
  Bug#26938: profiling client hang if used before enabled
  
  In the SHOW command, not sending header data because we had no 
  rows to send was a protocol violation.  Porting the SHOW PROFILE
  command to use the Information Schema table avoids that problem.
[28 Jun 2007 16:07] 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/29871

ChangeSet@1.2472, 2007-06-28 11:57:36-04:00, cmiller@zippy.cornsilk.net +8 -0
  Unify profiling SHOW code and INFORMATION_SCHEMA code for
  profiling.  Also,
  
  Bug#26938: profiling client hang if used before enabled
  
  In the SHOW command, not sending header data because we had no 
  rows to send was a protocol violation.  Porting the SHOW PROFILE
  command to use the Information Schema table avoids that problem.
[28 Jun 2007 16:15] Chad MILLER
Queued to 5.0-comeng tree.
[2 Jul 2007 11:28] 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/30060

ChangeSet@1.2478, 2007-07-02 07:27:39-04:00, cmiller@zippy.cornsilk.net +8 -0
  Unify profiling SHOW code and INFORMATION_SCHEMA code for
  profiling.  Also,
  
  Bug#26938: profiling client hang if used before enabled
  
  In the SHOW command, not sending header data because we had no 
  rows to send was a protocol violation.  Porting the SHOW PROFILE
  command to use the Information Schema table avoids that problem.
[5 Jul 2007 15:30] Chad MILLER
Applied to community tree ONLY, v5.0.45.
[6 Jul 2007 3:08] Paul Dubois
Noted in 5.0.45 changelog.

SHOW PROFILE hung if executed before enabling the @@profiling session 
variable.
[28 Jan 2008 6:40] Bugs System
Pushed into 6.0.5-alpha
[28 Jan 2008 6:50] Bugs System
Pushed into 5.1.24-rc
[6 Mar 2008 5:44] Jon Stephens
Fix also documented for 5.1.23-ndb-6.2.14, 5.1.24, and 6.0.5.
[30 Mar 2008 0:38] Jon Stephens
Also documented for 5.1.23-ndb-6.3.11.