Bug #70304 Debug assertion in close_thread_table
Submitted: 11 Sep 2013 19:33 Modified: 2 Dec 2014 20:12
Reporter: George Lorch (OCA) Email Updates:
Status: Verified Impact on me:
Category:MySQL Server: Security: Privileges Severity:S3 (Non-critical)
Version:5.5.33, 5.5.42 OS:Linux
Assigned to: CPU Architecture:Any

[11 Sep 2013 19:33] George Lorch
Debug assertion in close_thread_table if acl_load returns error anytime after init_read_record has been called.

How to repeat:
Discovered this while testing a new Percona Server specific feature and verified it in MySQL:

Inject in sql/sql_acl.cc:acl_reload anywhere after the call to init_read_record
  return_val= FALSE;
  goto end;

Compile (debug) and start the server:

mysqld: /home/glorch/dev/ms-5.5/sql/sql_base.cc:1577: bool close_thread_table(THD*, TABLE**): Assertion `!table->file || table->file->inited == handler::NONE' failed.

Program received signal SIGABRT, Aborted.
0x000000391a8328a5 in raise () from /lib64/libc.so.6
Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.80.el6_3.6.x86_64 libaio-0.3.107-10.el6.x86_64 libgcc-4.4.6-4.el6.x86_64 libstdc++-4.4.6-4.el6.x86_64 nss-softokn-freebl-3.12.9-11.el6.x86_64 zlib-1.2.3-29.el6.x86_64
(gdb) bt
#0  0x000000391a8328a5 in raise () from /lib64/libc.so.6
#1  0x000000391a834085 in abort () from /lib64/libc.so.6
#2  0x000000391a82ba1e in __assert_fail_base () from /lib64/libc.so.6
#3  0x000000391a82bae0 in __assert_fail () from /lib64/libc.so.6
#4  0x000000000058e2a5 in close_thread_table (thd=0x1a23280, table_ptr=0x1a23310) at /home/glorch/dev/ms-5.5/sql/sql_base.cc:1577
#5  0x000000000058dcff in close_open_tables (thd=0x1a23280) at /home/glorch/dev/ms-5.5/sql/sql_base.cc:1356
#6  0x000000000058e1f7 in close_thread_tables (thd=0x1a23280) at /home/glorch/dev/ms-5.5/sql/sql_base.cc:1563
#7  0x000000000059cdfb in close_mysql_tables (thd=0x1a23280) at /home/glorch/dev/ms-5.5/sql/sql_base.cc:9313
#8  0x0000000000571dcc in acl_reload (thd=0x1a23280) at /home/glorch/dev/ms-5.5/sql/sql_acl.cc:1187
#9  0x00000000005711a3 in acl_init (dont_read_acl_tables=false) at /home/glorch/dev/ms-5.5/sql/sql_acl.cc:643
#10 0x000000000054dd62 in mysqld_main (argc=13, argv=0x12ac298) at /home/glorch/dev/ms-5.5/sql/mysqld.cc:4528
#11 0x00000000005476a4 in main (argc=2, argv=0x7fffffffe648) at /home/glorch/dev/ms-5.5/sql/main.cc:25
[3 Dec 2013 19:57] Sveta Smirnova
Thank you for the report.

> Compile (debug) and start the server:

I do it every day and get no error. Please indicate which options you specified when compiled the server and when started.
[4 Jan 2014 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[3 Sep 2014 0:57] George Lorch
You need to do more than just build debug, you need to force sql/sql_acl.cc:acl_reload to return FALSE anywhere after the call to init_read_record. Still reproducible on 5.6.20.
[2 Dec 2014 20:12] Sveta Smirnova
Thank you for the feedback.

Verified as described. Not repeatable with version 5.6
[6 Jan 2018 5:10] Roel Van de Paar
Any updates on this?
[27 Mar 2018 7:46] Roel Van de Paar
It would be good to see this fixed.