[MCOL-4282] Prepared Statement Causing Signal 11 Created: 2020-08-29  Updated: 2020-09-25  Resolved: 2020-09-25

Status: Closed
Project: MariaDB ColumnStore
Component/s: None
Affects Version/s: None
Fix Version/s: 5.4.1

Type: Bug Priority: Blocker
Reporter: Todd Stoffel (Inactive) Assignee: Daniel Lee (Inactive)
Resolution: Fixed Votes: 0
Labels: None

Attachments: File MCOL-4282-2.sql     File MCOL-4282-2.sql.ref.log     File MCOL-4282.sql     File MCOL-4282.sql.ref.log    
Issue Links:
Blocks
blocks MCOL-3935 Power BI Direct Query Adapter Closed
Sprint: 2020-8

 Description   

The following query works fine when not included into a prepared statement. Once that is done, it crashes mysqld on EXECUTE.

SET @SQL :='
select `airline`,
    sum(cast(`cancelled` as DOUBLE)) as `C1`
from
(
    select `OTBL`.`cancelled`,
        `ITBL`.`airline`
    from `flights`.`flights` as `OTBL`
    left outer join `flights`.`airlines` as `ITBL` on (`OTBL`.`carrier` = `ITBL`.`iata_code`)
) as `ITBL`
group by `airline`
limit 1000001';
 
PREPARE stmt FROM @SQL;
 
EXECUTE stmt;

200829  3:49:21 [ERROR] mysqld got signal 11 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
 
To report this bug, see https://mariadb.com/kb/en/reporting-bugs
 
We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed,
something is definitely wrong and this may fail.
 
Server version: 10.4.13-7-MariaDB-enterprise
key_buffer_size=134217728
read_buffer_size=131072
max_used_connections=6
max_threads=153
thread_count=12
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 467760 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.
 
Thread pointer: 0x7f63b40009a8
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 0x7f6430131cf0 thread_stack 0x49000
/usr/sbin/mysqld(my_print_stacktrace+0x2e)[0x55f0f16c7d9e]
/usr/sbin/mysqld(handle_fatal_signal+0x30f)[0x55f0f114c94f]
sigaction.c:0(__restore_rt)[0x7f644ca76630]
/usr/sbin/mysqld(+0xcd7632)[0x55f0f156a632]
/usr/sbin/mysqld(_Z25create_internal_tmp_tableP5TABLEP6st_keyP18st_maria_columndefPS4_y+0x11f)[0x55f0f0f7865f]
/usr/sbin/mysqld(_Z35create_internal_tmp_table_from_heapP3THDP5TABLEP18st_maria_columndefPS4_ibPb+0xcc8)[0x55f0f0f84928]
/usr/sbin/mysqld(_ZN16Pushdown_derived7executeEv+0x32f)[0x55f0f0fbd2bf]
/usr/sbin/mysqld(+0x673e00)[0x55f0f0f06e00]
/usr/sbin/mysqld(_Z27mysql_handle_single_derivedP3LEXP10TABLE_LISTj+0x104)[0x55f0f0f06bf4]
/usr/sbin/mysqld(_ZN13st_join_table12preread_initEv+0x79)[0x55f0f0f73299]
/usr/sbin/mysqld(_Z10sub_selectP4JOINP13st_join_tableb+0x178)[0x55f0f0f734d8]
/usr/sbin/mysqld(_ZN4JOIN10exec_innerEv+0xc73)[0x55f0f0f9f813]
/usr/sbin/mysqld(_ZN4JOIN4execEv+0x33)[0x55f0f0f9fa43]
/usr/sbin/mysqld(_Z12mysql_selectP3THDP10TABLE_LISTjR4ListI4ItemEPS4_jP8st_orderS9_S7_S9_yP13select_resultP18st_select_lex_unitP13st_select_lex+0x186)[0x55f0f0f9dc96]
/usr/sbin/mysqld(_Z13handle_selectP3THDP3LEXP13select_resultm+0x1d7)[0x55f0f0f9e807]
/usr/sbin/mysqld(+0x5a3a47)[0x55f0f0e36a47]
/usr/sbin/mysqld(_Z21mysql_execute_commandP3THD+0x3b28)[0x55f0f0f444f8]
/usr/sbin/mysqld(_ZN18Prepared_statement7executeEP6Stringb+0x516)[0x55f0f0f5c466]
/usr/sbin/mysqld(_ZN18Prepared_statement12execute_loopEP6StringbPhS2_+0x92)[0x55f0f0f5c602]
/usr/sbin/mysqld(_Z22mysql_sql_stmt_executeP3THD+0x172)[0x55f0f0f5c912]
/usr/sbin/mysqld(_Z21mysql_execute_commandP3THD+0x200d)[0x55f0f0f429dd]
/usr/sbin/mysqld(_Z11mysql_parseP3THDPcjP12Parser_statebb+0x1fb)[0x55f0f0f499db]
/usr/sbin/mysqld(_Z16dispatch_command19enum_server_commandP3THDPcjbb+0x199f)[0x55f0f0f4bbaf]
/usr/sbin/mysqld(_Z10do_commandP3THD+0x109)[0x55f0f0f4d1f9]
/usr/sbin/mysqld(_Z24do_handle_one_connectionP7CONNECT+0x221)[0x55f0f102db31]
/usr/sbin/mysqld(handle_one_connection+0x3d)[0x55f0f102dbed]
pthread_create.c:0(start_thread)[0x7f644ca6eea5]
/lib64/libc.so.6(clone+0x6d)[0x7f644a83b8dd]
 
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0x7f63b402a1c8): select `airline`,     sum(cast(`cancelled` as DOUBLE)) as `C1` from (     select `OTBL`.`cancelled`,         `ITBL`.`airline`     from `flights`.`flights` as `OTBL`     left outer join `flights`.`airlines` as `ITBL` on (`OTBL`.`carrier` = `ITBL`.`iata_code`) ) as `ITBL` group by `airline` limit 1000001
Connection ID (thread ID): 13
Status: NOT_KILLED
 
Optimizer switch: index_merge=off,index_merge_union=off,index_merge_sort_union=off,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=on,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=on,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off,condition_pushdown_from_having=on
 
The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.
Writing a core file...
Working directory at /var/lib/mysql
Resource Limits:
Limit                     Soft Limit           Hard Limit           Units
Max cpu time              unlimited            unlimited            seconds
Max file size             unlimited            unlimited            bytes
Max data size             unlimited            unlimited            bytes
Max stack size            8388608              unlimited            bytes
Max core file size        0                    unlimited            bytes
Max resident set          unlimited            unlimited            bytes
Max processes             256804               256804               processes
Max open files            16364                16364                files
Max locked memory         65536                65536                bytes
Max address space         unlimited            unlimited            bytes
Max file locks            unlimited            unlimited            locks
Max pending signals       256804               256804               signals
Max msgqueue size         819200               819200               bytes
Max nice priority         0                    0
Max realtime priority     0                    0
Max realtime timeout      unlimited            unlimited            us
Core pattern: core



 Comments   
Comment by Todd Stoffel (Inactive) [ 2020-08-31 ]

DDL located here:

https://github.com/mariadb-corporation/mariadb-columnstore-samples

Comment by Daniel Lee (Inactive) [ 2020-09-16 ]

Build verified: 1.5.4-1 (Drone #631)

MariaDB [bts]> select `airline`,
-> sum(cast(`cancelled` as DOUBLE)) as `C1`
-> from
-> (
-> select `OTBL`.`cancelled`,
-> `ITBL`.`airline`
-> from `bts`.`flights` as `OTBL`
-> left outer join `bts`.`airlines` as `ITBL` on (`OTBL`.`carrier` = `ITBL`.`iata_code`)
-> ) as `ITBL`
-> group by `airline`
-> limit 1000001;
-----------------------+

airline C1

-----------------------+

American Airlines NULL

-----------------------+
1 row in set (0.118 sec)

MariaDB [bts]> EXECUTE stmt;
-----------------------+

airline C1

-----------------------+

American Airlines NULL

-----------------------+
1 row in set (0.033 sec)

Comment by Gagan Goel (Inactive) [ 2020-09-25 ]

MCOL-4282.sql.ref.log MCOL-4282.sql MCOL-4282-2.sql.ref.log MCOL-4282-2.sql

For QA: In addition to running the original query in the ticket description, please execute the 2 attached SQL files for testing this ticket. The associated .ref.log files containing the expected output are also attached.

Comment by Daniel Lee (Inactive) [ 2020-09-25 ]

What is the 2nd issue? Is it just query results not correct, error, crash? I need that info to reproduce the issue.

Comment by Daniel Lee (Inactive) [ 2020-09-25 ]

Build verified: 5.4.1 )(Drone #762)

In 1.5.3-1

Executed the the two queries. The first query caused mysqld to crash.

[centos7:root~]# mysql -f tpch1 < /data/qa/shares/MCOL-4282.sql
ERROR 2013 (HY000) at line 3: Lost connection to MySQL server during query
ERROR 2006 (HY000) at line 4: MySQL server has gone away
ERROR 2006 (HY000) at line 5: MySQL server has gone away
ERROR 2006 (HY000) at line 6: MySQL server has gone away
.
.

[centos7:root~]# cat crit.log
Sep 25 21:41:41 localhost ExeMgr[13161]: 41.042612 |14|0|0| C 16 CAL0055: ERROR: ExeMgr has caught an exception. ExeMgr: error projecting rows for tableOID: 100; rowCnt: 8192; prevTotRowCnt: 425984; InetStreamSocket::write error: Connection reset by peer – write from InetStreamSocket: sd: 15 inet: 127.0.0.1 port: 42712

Verify fixed in 5.4.1-1

Comment by Gagan Goel (Inactive) [ 2020-09-25 ]

dleeyh Since your initial testing from 2020-09-16 11:21, we identified more queries which were crashing the server. These queries are present in MCOL-4282.sql and MCOL-4282-2.sql files that I attached above. These crashes are now fixed in the latest drone builds starting from 762.

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