Bug #83114 Assertion `strlen(db_name) <= (64*3) && strlen(table_name) <= (64*3)' failed.
Submitted: 23 Sep 2016 4:20 Modified: 13 Jan 2017 17:56
Reporter: Roel Van de Paar Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: DML Severity:S1 (Critical)
Version:8.0-dmr OS:Any
Assigned to: CPU Architecture:Any

[23 Sep 2016 4:20] Roel Van de Paar
Description:
2016-09-23T04:01:59.390992Z 0 [Note] /sda/MS130916-mysql-8.0.0-dmr-linux-x86_64-debug/bin/mysqld: ready for connections.
Version: '8.0.0-dmr-debug'  socket: '/sda/MS130916-mysql-8.0.0-dmr-linux-x86_64-debug/socket.sock'  port: 15348  MySQL Community Server (GPL)
mysqld: /git/MS8.0_dbg/sql/sql_base.cc:277: size_t create_table_def_key(THD*, char*, const char*, const char*, bool): Assertion `strlen(db_name) <= (64*3) && strlen(table_name) <= (64*3)' failed.
04:02:01 UTC - mysqld got signal 6 ;

+bt
#0  0x00007f84d9297741 in __pthread_kill (threadid=<optimized out>, signo=6) at ../nptl/sysdeps/unix/sysv/linux/pthread_kill.c:61
#1  0x00000000023fc1b9 in my_write_core (sig=6) at /git/MS8.0_dbg/mysys/stacktrace.cc:275
#2  0x0000000001b517ed in handle_fatal_signal (sig=6) at /git/MS8.0_dbg/sql/signal_handler.cc:219
#3  <signal handler called>
#4  0x00007f84d762e5f7 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#5  0x00007f84d762fce8 in __GI_abort () at abort.c:90
#6  0x00007f84d7627566 in __assert_fail_base (fmt=0x7f84d7777ce8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x2978028 "strlen(db_name) <= (64*3) && strlen(table_name) <= (64*3)", file=file@entry=0x2978008 "/git/MS8.0_dbg/sql/sql_base.cc", line=line@entry=277, function=function@entry=0x297a6c0 <create_table_def_key(THD*, char*, char const*, char const*, bool)::__PRETTY_FUNCTION__> "size_t create_table_def_key(THD*, char*, const char*, const char*, bool)") at assert.c:92
#7  0x00007f84d7627612 in __GI___assert_fail (assertion=0x2978028 "strlen(db_name) <= (64*3) && strlen(table_name) <= (64*3)", file=0x2978008 "/git/MS8.0_dbg/sql/sql_base.cc", line=277, function=0x297a6c0 <create_table_def_key(THD*, char*, char const*, char const*, bool)::__PRETTY_FUNCTION__> "size_t create_table_def_key(THD*, char*, const char*, const char*, bool)") at assert.c:101
#8  0x0000000001809bab in create_table_def_key (thd=0x7f84a7819000, key=0x7f84d9885e10 "0^\210ل\177", db_name=0x7f84a782e578 "test", table_name=0x7f84a782e150 'a' <repeats 1016 times>, tmp_table=true) at /git/MS8.0_dbg/sql/sql_base.cc:277
#9  0x000000000180d753 in find_temporary_table (thd=0x7f84a7819000, db=0x7f84a782e578 "test", table_name=0x7f84a782e150 'a' <repeats 1016 times>) at /git/MS8.0_dbg/sql/sql_base.cc:2235
#10 0x0000000001b7ef19 in MYSQLparse (YYTHD=0x7f84a7819000) at /git/MS8.0_dbg/sql/sql_yacc.yy:12077
#11 0x00000000018793d1 in parse_sql (thd=0x7f84a7819000, parser_state=0x7f84d988a4e0, creation_ctx=0x0) at /git/MS8.0_dbg/sql/sql_parse.cc:6858
#12 0x00000000018757df in mysql_parse (thd=0x7f84a7819000, parser_state=0x7f84d988a4e0) at /git/MS8.0_dbg/sql/sql_parse.cc:5126
#13 0x000000000186c3b8 in dispatch_command (thd=0x7f84a7819000, com_data=0x7f84d988ac70, command=COM_QUERY) at /git/MS8.0_dbg/sql/sql_parse.cc:1481
#14 0x000000000186b244 in do_command (thd=0x7f84a7819000) at /git/MS8.0_dbg/sql/sql_parse.cc:1043
#15 0x0000000001b43af1 in handle_connection (arg=0x7f84a716c080) at /git/MS8.0_dbg/sql/conn_handler/connection_handler_per_thread.cc:301
#16 0x000000000242bf29 in pfs_spawn_thread (arg=0x7f84a71e4f20) at /git/MS8.0_dbg/storage/perfschema/pfs.cc:2282
#17 0x00007f84d9292dc5 in start_thread (arg=0x7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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
[23 Sep 2016 8:54] MySQL Verification Team
Hello Roel,

Thank you for the report and test case.
I'm not seeing any crash with release/debug builds, anything else required to trigger this issue? Please let us know.

-- release/debug

rm -rf 83114
bin/mysqld  --initialize-insecure --basedir=/export/umesh/server/binaries/Trunk/mysql-advanced-8.0 --datadir=/export/umesh/server/binaries/Trunk/mysql-advanced-8.0/83114 -v
bin/mysqld --no-defaults --basedir=/export/umesh/server/binaries/Trunk/mysql-advanced-8.0 --datadir=/export/umesh/server/binaries/Trunk/mysql-advanced-8.0/83114 --core-file --socket=/tmp/mysql_ushastry.sock  --port=3306 --log-error=/export/umesh/server/binaries/Trunk/mysql-advanced-8.0/83114/log.err 2>&1 &

mysql> DROP DATABASE test;
ERROR 1008 (HY000): Can't drop database 'test'; database doesn't exist
mysql> explain aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
ERROR 1046 (3D000): No database selected
mysql>

Thanks,
Umesh
[26 Sep 2016 7:08] Roel Van de Paar
I get this;

mysql> DROP DATABASE test;
ERROR 1008 (HY000): Can't drop database 'test'; database doesn't exist
mysql> explain aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
ERROR 2013 (HY000): Lost connection to MySQL server during query

[roel@localhost MS130916-mysql-8.0.0-dmr-linux-x86_64-debug]$ cat start
MYEXTRA=" --no-defaults"
/sda/MS130916-mysql-8.0.0-dmr-linux-x86_64-debug/bin/mysqld ${MYEXTRA} --core-file --basedir=/sda/MS130916-mysql-8.0.0-dmr-linux-x86_64-debug --tmpdir=/sda/MS130916-mysql-8.0.0-dmr-linux-x86_64-debug/data --datadir=/sda/MS130916-mysql-8.0.0-dmr-linux-x86_64-debug/data  --socket=/sda/MS130916-mysql-8.0.0-dmr-linux-x86_64-debug/socket.sock --port=15348 --log-error=/sda/MS130916-mysql-8.0.0-dmr-linux-x86_64-debug/log/master.err 2>&1 &
echo 'Server socket: /sda/MS130916-mysql-8.0.0-dmr-linux-x86_64-debug/socket.sock with datadir: /sda/MS130916-mysql-8.0.0-dmr-linux-x86_64-debug/data'

[roel@localhost MS130916-mysql-8.0.0-dmr-linux-x86_64-debug]$ cat cl
/sda/MS130916-mysql-8.0.0-dmr-linux-x86_64-debug/bin/mysql -A -uroot -S/sda/MS130916-mysql-8.0.0-dmr-linux-x86_64-debug/socket.sock --force --binary-mode test
[26 Sep 2016 7:09] Roel Van de Paar
cmake . -DWITH_ZLIB=system -DCMAKE_BUILD_TYPE=Debug -DBUILD_CONFIG=mysql_release -DFEATURE_SET=community -DDEBUG_EXTNAME=OFF -DWITH_EMBEDDED_SERVER=OFF -DENABLE_DOWNLOADS=1 -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/tmp -DWITH_SSL=system -DWITH_PAM=ON 

make -j5
[28 Sep 2016 19:11] Erlend Dahl
Umesh: it reproduces in my sandbox on latest trunk. Not reproducible on 5.7.
[29 Sep 2016 4:29] MySQL Verification Team
Thank you Erlend for confirming.

Regards,
Umesh
[29 Sep 2016 5:25] MySQL Verification Team
couldn't repeat when i dropped the database.  I had to have it created and in use!

mysql> use test;
Database changed
mysql> explain aaaaaaaaaaaaaaa <snip!>

Version: '8.0.1-dmr-debug-log'  (Built on 28 August 2016)
[New Thread 0x7ffff7f8d700 (LWP 24783)]
mysqld: ./sql/sql_base.cc:277: size_t create_table_def_key(THD *, char *, const char *, const char *, bool): Assertion `strlen(db_name) <= (64*3) && strlen(table_name) <= (64*3)' failed.
[29 Sep 2016 5:55] Erlend Dahl
Shane: you are right, I also had to remove 'DROP DATABASE'.
[29 Sep 2016 7:22] Roel Van de Paar
Hmm (as a second issue) this must be something in the scripts, and there is more to this I think.

I saw;

mysql> DROP DATABASE test;
ERROR 1008 (HY000): Can't drop database 'test'; database doesn't exist

Some of the scripts do things like mkdir test etc. - there have been some changes in different versions before and perhaps again now. This needs more testing.
[30 Sep 2016 11:35] Erlend Dahl
Roel, please file separate issues as new bugs. We already have one report in this area:

Bug#83140 "use db_name" and "select schema()" work for non-existing databases
[13 Jan 2017 17:56] Paul DuBois
Posted by developer:
 
Noted in 8.0.1 changelog.

For debug builds, EXPLAIN or DESCRIBE for a table with a database or
table name longer than the maximum permitted length raised an
assertion rather than displaying an appropriate error.