Bug #57274 SET GLOBAL debug crashes on Solaris in embedded mode (variables_debug fails)
Submitted: 6 Oct 2010 7:55 Modified: 20 Nov 2010 17:55
Reporter: Jon Olav Hauglid Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Logging Severity:S3 (Non-critical)
Version:5.1, 5.5 OS:Solaris
Assigned to: Jon Olav Hauglid CPU Architecture:Any

[6 Oct 2010 7:55] Jon Olav Hauglid
Description:
Stack trace:

  [1] __lwp_kill(0xd, 0xb), at 0xfecaa0b7 
  [2] _thr_kill(0xd, 0xb, 0xfed1fc98, 0x81b6e4a), at 0xfeca5814 
=>[3] my_write_core(sig = 11), line 328 in "stacktrace.c"
  [4] signal_handler(sig = 11), line 7939 in "mysqltest.cc"
  [5] __sighndlr(0xb, 0x0, 0xfd905d68, 0x818ace0), at 0xfeca742f 
  [6] call_user_handler(0xb, 0x0, 0xfd905d68), at 0xfec9d141 
  [7] sigacthandler(0xb, 0x0, 0xfd905d68, 0xf, 0x0, 0x0), at 0xfec9d26b 
  ---- called from signal handler with signal 11 (SIGSEGV) ------
  [8] strlen(0x870876e, 0xfd906b38, 0x8b6a868, 0x0), at 0xfec2598c 
  [9] _fprintf(0x8b6a868, 0x870876c, 0x0, 0x8b4f858), at 0xfec82fb9 
  [10] DBUGOpenFile(cs = 0xfd906bc0, name = 0x8b4f858 "../../log/bug46165.1.trace", end = 0x92b46ed "", append = 0), line 2003 in "dbug.c"
  [11] DbugParse(cs = 0xfd906bc0, control = 0x92b46d3 "../../log/bug46165.1.trace"), line 650 in "dbug.c"
  [12] _db_set_init_(control = 0x92b46d0 "+O,../../log/bug46165.1.trace"), line 908 in "dbug.c"
  [13] Sys_var_dbug::global_update(this = 0x8b5f240, thd = 0x92b9b08, var = 0x92b46a8), line 548 in "sys_vars.h"
  [14] sys_var::update(this = 0x8b5f240, thd = 0x92b9b08, var = 0x92b46a8), line 205 in "set_var.cc"
  [15] set_var::update(this = 0x92b46a8, thd = 0x92b9b08), line 673 in "set_var.cc"
  [16] sql_set_variables(thd = 0x92b9b08, var_list = 0x92bb3a0), line 577 in "set_var.cc"
  [17] mysql_execute_command(thd = 0x92b9b08), line 3136 in "sql_parse.cc"
  [18] mysql_parse(thd = 0x92b9b08, rawbuf = 0x92b4520 "SET GLOBAL  debug= '+O,../../log/bug46165.1.trace'", length = 50U, parser_state = 0xfd907e00), line 5554 in "sql_parse.cc"

How to repeat:
./mtr variables_debug --embedded-server

Seen on mysql-5.5-runtime
[6 Oct 2010 10:14] Jon Olav Hauglid
Also repeatable in 5.1 on Solaris with just running the following statement:
  SET GLOBAL  debug= '+O,../../log/bug46165.1.trace';

(Thanks to Olav for helping with verifying this).
[6 Oct 2010 10:50] Jon Olav Hauglid
This crash only happens if the trace file is not put into the current directory.
SET GLOBAL debug= '+O, test.trace'    <= Works ok
SET GLOBAL debug= '+O, ../test.trace' <= Crashes

And it only happens for SET GLOBAL debug, not SET SESSION debug.
[6 Oct 2010 14:42] 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/120139

3156 Jon Olav Hauglid	2010-10-06
      Bug #57274 SET GLOBAL debug crashes on Solaris in embedded server mode
      
      The problem was that "SET GLOBAL debug" could cause a crash on Solaris.
      The crash happened if the server failed to open the trace file given in 
      the "SET GLOBAL debug" statement. This caused an error message to be
      printed to stderr containing the process name. However, printing to
      stderr crashed the server since the pointer to the process name had
      not been initialized.
      
      This patch fixes the problem by initializing the process name 
      properly when doing "SET GLOBAL debug".
      
      No test case added as this bug was repeatable with existing test
      coverage in variables_debug.test.
[19 Oct 2010 8:20] 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/121067

3535 Jon Olav Hauglid	2010-10-19
      Bug #57274 SET GLOBAL debug crashes on Solaris in embedded server mode
                 (variables_debug fails)
      
      The problem was that "SET GLOBAL debug" could cause a crash on Solaris.
      The crash happened if the server failed to open the trace file given in 
      the "SET GLOBAL debug" statement. This caused an error message to be
      printed to stderr containing the process name. However, printing to
      stderr crashed the server since the pointer to the process name had
      not been initialized.
      
      This patch fixes the problem by initializing the process name 
      properly when doing "SET GLOBAL debug".
      
      No test case added as this bug was repeatable with existing test
      coverage in variables_debug.test.
[19 Oct 2010 9:16] Jon Olav Hauglid
Pushed to mysql-5.1-bugteam (5.1.52) and merged to mysql-5.5-bugteam and mysql-trunk-merge.
[13 Nov 2010 16:19] Bugs System
Pushed into mysql-trunk 5.6.99-m5 (revid:alexander.nozdrin@oracle.com-20101113155825-czmva9kg4n31anmu) (version source revid:alexander.nozdrin@oracle.com-20101113152450-2zzcm50e7i4j35v7) (merge vers: 5.6.1-m4) (pib:21)
[13 Nov 2010 16:29] Bugs System
Pushed into mysql-next-mr (revid:alexander.nozdrin@oracle.com-20101113160336-atmtmfb3mzm4pz4i) (version source revid:vasil.dimov@oracle.com-20100629074804-359l9m9gniauxr94) (pib:21)
[18 Nov 2010 15:53] Bugs System
Pushed into mysql-5.1 5.1.54 (revid:build@mysql.com-20101118153531-693taxtxyxpt037i) (version source revid:build@mysql.com-20101118153531-693taxtxyxpt037i) (merge vers: 5.1.54) (pib:21)
[20 Nov 2010 17:55] Paul Dubois
Noted in 5.1.53, 5.5.8 changelogs.

SET GLOBAL debug could cause a crash on Solaris if the server failed
to open the trace file.
[16 Dec 2010 22:30] Bugs System
Pushed into mysql-5.5 5.5.9 (revid:jonathan.perkin@oracle.com-20101216101358-fyzr1epq95a3yett) (version source revid:jonathan.perkin@oracle.com-20101216101358-fyzr1epq95a3yett) (merge vers: 5.5.9) (pib:24)