[MCOL-693] Segmentation Fault with non-string SP parameter Created: 2017-04-28  Updated: 2017-05-04  Resolved: 2017-05-04

Status: Closed
Project: MariaDB ColumnStore
Component/s: None
Affects Version/s: 1.0.8, 1.1.0
Fix Version/s: 1.0.9, 1.1.0

Type: Bug Priority: Critical
Reporter: Seungmin Yang Assignee: Daniel Lee (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Environment:

RHEL 6.6


Attachments: File columnstoreSupportReport.columnstore-1.tar.gz    
Sprint: 2017-9

 Description   

While I was using MariaDB ColumnStore, segmentation fault occured.
I don't remember what i was executing, for example, the name of command....

Log messages in dmesg command are belows:

  1. dmesg
    mysqld[24682] general protection ip:5ce984 sp:7f7653fa70e0 error:0 in mysqld[400000+cbd000]
    mysqld[24842] general protection ip:5ce984 sp:7fb4280f80e0 error:0 in mysqld[400000+cbd000]
    mysqld[24846] general protection ip:5ce984 sp:7fb4202f10e0 error:0 in mysqld[400000+cbd000]
    mysqld[12185] general protection ip:5ce984 sp:7f742409e0e0 error:0 in mysqld[400000+cbd000]
    mysqld[12342] general protection ip:5ce984 sp:7f9f9813c0e0 error:0 in mysqld[400000+cbd000]
    mysqld[12411] general protection ip:5ce984 sp:7f2b7c2ab0e0 error:0 in mysqld[400000+cbd000]
    mysqld[12478] general protection ip:5ce984 sp:7f6ae9a8c0e0 error:0 in mysqld[400000+cbd000]
    mysqld[13900] general protection ip:5ce984 sp:7fb3642e30e0 error:0 in mysqld[400000+cbd000]
    mysqld[13955] general protection ip:5ce984 sp:7f0bbe2e30e0 error:0 in mysqld[400000+cbd000]
    mysqld[20023] general protection ip:5ce984 sp:7fb9a01850e0 error:0 in mysqld[400000+cbd000]
    mysqld[20556] general protection ip:5ce984 sp:7f10dca9c0e0 error:0 in mysqld[400000+cbd000]
    mysqld[20702] general protection ip:5ce984 sp:7f2b5816c0e0 error:0 in mysqld[400000+cbd000]
    mysqld[7841] general protection ip:5ce984 sp:7f8c4d1020e0 error:0 in mysqld[400000+cbd000]
    mysqld[8422] general protection ip:5ce984 sp:7f176b7a80e0 error:0 in mysqld[400000+cbd000]
    mysqld[19877] general protection ip:5ce984 sp:7f55983f30e0 error:0 in mysqld[400000+cbd000]
    mysqld[19974] general protection ip:5ce984 sp:7fbb3ebc70e0 error:0 in mysqld[400000+cbd000]
    mysqld[20077] general protection ip:5ce984 sp:7f462dce00e0 error:0 in mysqld[400000+cbd000]
    mysqld[20319] general protection ip:5ce984 sp:7f30550c60e0 error:0 in mysqld[400000+cbd000]
    mysqld[20792] general protection ip:5ce984 sp:7f0bac0b90e0 error:0 in mysqld[400000+cbd000]
    mysqld[24816] general protection ip:5ce984 sp:7fdddd9a20e0 error:0 in mysqld[400000+cbd000]
    ExeMgr[1888]: segfault at 0 ip (null) sp 00007fb10ce1fcd8 error 14 in ExeMgr[400000+31000]
    ExeMgr[10967]: segfault at 305 ip 0000003427208143 sp 00007fc70bffd7d0 error 4 in libpthread-2.12.so[3427200000+17000]
    ExeMgr[19791]: segfault at 7f2c00008940 ip 00000034272093a0 sp 00007f2e57fed818 error 4 in libpthread-2.12.so[3427200000+17000]
    ExeMgr[30968]: segfault at 305 ip 0000003427208143 sp 00007f0f339f67d0 error 4 in libpthread-2.12.so[3427200000+17000]
    ExeMgr[15618] general protection ip:7faf1c28d6f0 sp:7faed0df8b78 error:0 in libjoblist.so.1.0.0[7faf1c189000+334000]

I'm sorry that there is not enough information..
Could you let me know if you know what the problem is?

Thank you.



 Comments   
Comment by Andrew Hutchings (Inactive) [ 2017-04-28 ]

Can you please run the MariaDB ColumnStore support tool and attach the resulting .tar.gz? This will help give us a clearer picture of what is going on across the cluster at the time of failure:

https://mariadb.com/kb/en/mariadb/system-troubleshooting-mariadb-columnstore/#mariadb-columnstore-support-tool

Comment by Seungmin Yang [ 2017-05-02 ]

Thank you for your comment.
I attached ColumnStore support tool report.

Comment by Andrew Hutchings (Inactive) [ 2017-05-02 ]

Many thanks for the report. The problem occurs when this is executed:

call stm.SP_STM_SET_NCSC_STATUS(-1)

Can you please show us the contents of this stored procedure so that we can reproduce this?

Comment by Seungmin Yang [ 2017-05-02 ]

The contents of procedure is belows:
BEGIN
UPDATE stm.ncsc_alert_status
SET status=p_status, datetime=now();
END

There is no error when I input quotation mark.

MariaDB [(none)]> call stm.SP_STM_SET_NCSC_STATUS(-1);
ERROR 2013 (HY000): Lost connection to MySQL server during query
MariaDB [(none)]>

MariaDB [(none)]> call stm.SP_STM_SET_NCSC_STATUS('-1');
Query OK, 1 row affected (0.00 sec)

Comment by Andrew Hutchings (Inactive) [ 2017-05-02 ]

Excellent, many thanks. I've been able to easily reproduce this and found the cause. The workaround for now is to use quotes as you have indicated.

For ColumnStore team:
In the vtable processing in sql_parse.cc we do:

std::string arg_val = arg_item->name;

This assumes the parameter is always a string, the item may not have string data in it. In this case we probably should have used arg_item->val_int() to get the value so we probably need a type based switch statement or something that forces arg_item->str_value to be generated (the latter may be easier). My guess is for InfiniDB MySQL 5.1 automatically did the conversion whereas MariaDB 10.1/10.2 do not for optimisation purposes.

This problem affects non-ColumnStore and ColumnStore tables as is in the vtable detection code.

Test case:

create table t2 (a int, b datetime) engine=columnstore;
insert into t2 values (1, now());
delimiter //
create procedure t2_test(my_in INT)
BEGIN
UPDATE t2 SET a=my_in, b=now();
END
//
delimiter ;
call t2_test(-1);

Comment by Andrew Hutchings (Inactive) [ 2017-05-04 ]

Server tree pull request for develop and develop-1.0

Comment by Daniel Lee (Inactive) [ 2017-05-04 ]

Build tested: 1.0.9-1 and 1.1.0-1 GitHub source

1.0.9-1
[root@localhost mariadb-columnstore-server]# git show
commit 675a7de1d5d793900b92549e1da3d82a49caa381
Merge: 6e3afaa 76bfb2b
Author: dhall-InfiniDB <david.hall@mariadb.com>
Date: Thu May 4 11:02:43 2017 -0500

Merge pull request #47 from mariadb-corporation/MCOL-693-1.0

MCOL-693 Fix non-string SP parameters

[root@localhost mariadb-columnstore-server]# cd mariadb-columnstore-engine/
[root@localhost mariadb-columnstore-engine]# git show
commit 85c7be75625b7b3f515b83956ee2b0acb6c550a3
Merge: b6efffb f5881ce
Author: dhall-InfiniDB <david.hall@mariadb.com>
Date: Wed Apr 26 09:42:51 2017 -0500

Merge pull request #159 from mariadb-corporation/MCOL-683-1.0

MCOL-683 Fix nested ADDDATE and DATE_FORMAT

1.1.0-1

[root@localhost mariadb-columnstore-server]# git show
commit bd13090ea83f35f125c1d103204c0070ae0f721b
Merge: abc4c52 f63ee30
Author: dhall-InfiniDB <david.hall@mariadb.com>
Date: Thu May 4 11:01:51 2017 -0500

Merge pull request #46 from mariadb-corporation/MCOL-693

MCOL-693 Fix non-string SP parameters

[root@localhost mariadb-columnstore-server]# cd mariadb-columnstore-engine/
[root@localhost mariadb-columnstore-engine]# git show
commit a6dfc3c366c861d5777a9931e18f594405e4aab6
Merge: 1c2a8fc 00cd7f4
Author: dhall-InfiniDB <david.hall@mariadb.com>
Date: Thu May 4 10:33:30 2017 -0500

Merge pull request #168 from mariadb-corporation/MCOL-698

MCOL-698 Fix joiner for LONGTEXT

Both branches returned the following error:

MariaDB [mytest]> create table t2 (a int, b datetime) engine=columnstore;
Query OK, 0 rows affected (0.16 sec)

MariaDB [mytest]> insert into t2 values (1, now());
Query OK, 1 row affected (0.09 sec)

MariaDB [mytest]> delimiter //
MariaDB [mytest]> create procedure t2_test(my_in INT)
-> BEGIN
-> UPDATE t2 SET a=my_in, b=now();
-> END
-> //
Query OK, 0 rows affected (0.00 sec)

MariaDB [mytest]> delimiter ;
MariaDB [mytest]> call t2_test(-1);
ERROR 1178 (42000): The storage engine for the table doesn't support This stored procedure syntax is not supported by Columnstore in this version
MariaDB [mytest]> call t2_test('-1');
ERROR 1178 (42000): The storage engine for the table doesn't support This stored procedure syntax is not supported by Columnstore in this version
MariaDB [mytest]> quit
Bye

Comment by Daniel Lee (Inactive) [ 2017-05-04 ]

reopen per my last comment

Comment by Andrew Hutchings (Inactive) [ 2017-05-04 ]

Sorry, my test was bad. The errors are expected behaviour instead of a crash in that case.

Improved test case:

create table t2 (a int, b datetime) engine=columnstore;
insert into t2 values (-1, now());
delimiter //
create procedure t2_test(my_in INT)
BEGIN
SELECT * FROM t2 WHERE a=my_in;
END
//
delimiter ;
call t2_test(-1);
call t2_test('-1');

The result should be similar to this for both call queries:

+------+---------------------+
| a    | b                   |
+------+---------------------+
|   -1 | 2017-05-04 20:39:19 |
+------+---------------------+
1 row in set (0.02 sec)

Before the fix the first would crash and the second would work.

Comment by Daniel Lee (Inactive) [ 2017-05-04 ]

Verified the same two builds using the new test case.

The issue was reproduced in 1.0.8-1.

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