[MCOL-1684] Performance Schema crashes prepared statement Created: 2018-08-30  Updated: 2020-08-25  Resolved: 2018-10-02

Status: Closed
Project: MariaDB ColumnStore
Component/s: None
Affects Version/s: 1.1.5
Fix Version/s: 1.1.6, 1.2.0

Type: Bug Priority: Major
Reporter: Andrew Hutchings (Inactive) Assignee: Daniel Lee (Inactive)
Resolution: Fixed Votes: 1
Labels: None

Attachments: File prep_stmt.php    
Issue Links:
Duplicate
is duplicated by MCOL-1685 Columnstore mysqld got signal 11 Closed

 Description   

Observed in a stack trace, a crash here in parse_sql.cc:

parser_state->m_lip.m_digest->m_digest_storage.m_charset_number= thd->charset()->number;

Stack for reference:

/lib64/libc.so.6(__fortify_fail+0x37)[0x7f54bd7aa6e7]
/lib64/libc.so.6(+0x116862)[0x7f54bd7a8862]
/lib64/libc.so.6(+0x118647)[0x7f54bd7aa647]
/usr/local/mariadb/columnstore/mysql//bin/mysqld(my_addr_resolve+0xda)[0x55f51cd1586a]
/usr/local/mariadb/columnstore/mysql//bin/mysqld(my_print_stacktrace+0x1aa)[0x55f51cd0396a]
/usr/local/mariadb/columnstore/mysql//bin/mysqld(handle_fatal_signal+0x33d)[0x55f51c836add]
/lib64/libpthread.so.0(+0xf6d0)[0x7f54bf5df6d0]
/usr/local/mariadb/columnstore/mysql//bin/mysqld(_Z9parse_sqlP3THDP12Parser_stateP19Object_creation_ctxb+0x96)[0x55f51c6d92b6]
/usr/local/mariadb/columnstore/mysql//bin/mysqld(_Z18idb_vtable_processP3THDyP9Statement+0xb21)[0x55f51c6dad41]
/usr/local/mariadb/columnstore/mysql//bin/mysqld(_ZN18Prepared_statement7executeEP6Stringb+0x5e2)[0x55f51c6ec5b2]
/usr/local/mariadb/columnstore/mysql//bin/mysqld(_ZN18Prepared_statement12execute_loopEP6StringbPhS2_+0x94)[0x55f51c6ec7c4]
/usr/local/mariadb/columnstore/mysql//bin/mysqld(+0x4e3279)[0x55f51c6ed279]
/usr/local/mariadb/columnstore/mysql//bin/mysqld(_Z19mysqld_stmt_executeP3THDPcj+0x23)[0x55f51c6ed313]
/usr/local/mariadb/columnstore/mysql//bin/mysqld(_Z16dispatch_command19enum_server_commandP3THDPcjbb+0x1033)[0x55f51c6ddcb3]
/usr/local/mariadb/columnstore/mysql//bin/mysqld(_Z10do_commandP3THD+0xd4)[0x55f51c6df304]
/usr/local/mariadb/columnstore/mysql//bin/mysqld(_Z11tp_callbackP13TP_connection+0xbf)[0x55f51c7cce1f]
/usr/local/mariadb/columnstore/mysql//bin/mysqld(+0x6087ce)[0x55f51c8127ce]
/usr/local/mariadb/columnstore/mysql//bin/mysqld(+0xac2c74)[0x55f51ccccc74]
/lib64/libpthread.so.0(+0x7e25)[0x7f54bf5d7e25]
/lib64/libc.so.6(clone+0x6d)[0x7f54bd790bad]

This happens when performance schema is enabled and a prepared statement is executed on a ColumnStore table. The fix is probably to do this in idb_vtable_process when parse_sql is called for COM_EXECUTE:

      parent_locker= thd->m_statement_psi;
      thd->m_statement_psi= NULL;
      parse_sql(...)
      thd->m_statement_psi= parent_locker;



 Comments   
Comment by Andrew Hutchings (Inactive) [ 2018-08-31 ]

To reproduce add the following line to my.cnf's [mysqld] section:

performance_schema

Create a ColumnStore table as follows:

create table test.t1 (a int) engine=columnstore;

Then run the attached PHP script. This will cause mysqld to crash as above.

Workaround is to not have performance_schema turned on.

Comment by Andrew Hutchings (Inactive) [ 2018-09-04 ]

Pull request for 1.1 and 1.2. Please do not merge until after 1.1.6 is released.

Comment by Andrew Hutchings (Inactive) [ 2018-09-05 ]

Looks like this got merged into 1.1 anyway so moved it to 1.1.6.

Comment by Daniel Lee (Inactive) [ 2018-10-02 ]

Build verified: 1.1.6-1 release, 1.2.0-1 Github source

1.2.0-1 source

/root/columnstore/mariadb-columnstore-server
commit 6b44f0d9c453ede53024f525b7ddf32b5323171b
Merge: 7db44a7 853a0f7
Author: Andrew Hutchings <andrew@linuxjedi.co.uk>
Date: Thu Sep 27 20:37:03 2018 +0100
Merge pull request #134 from mariadb-corporation/versionCmakeFix
port changes for mysql_version cmake to fix columnstore RPM packaging
/root/columnstore/mariadb-columnstore-server/mariadb-columnstore-engine
commit 3326be00de5f53ec365910f07a7fd882ba193d4d
Merge: ebbeb30 5cab6c4
Author: Andrew Hutchings <andrew@linuxjedi.co.uk>
Date: Tue Sep 18 13:57:17 2018 +0100
Merge pull request #565 from drrtuy/MCOL-1601
MCOL-1601 GROUP BY now supports subqueries in HAVING.

Need to install the following packages before testing:

php
php-mysqli

Reproduced the mysqld crashing issue in 1.1.5-1
Verified in both 1.1.6-1 and 1.2.0-1 that mysqld no longer crashing.

Generated at Thu Feb 08 02:30:35 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.