Crash / assertion failed - "void drizzled::Select_Lex::print(drizzled::Session*, drizzled::String*, drizzled::enum_query_type)") at assert.c:81 #3 0x00000000006282fb in drizzled::Select_Lex::print (this=0x3911418, session=0x0, str=0x7f26b77fd7c0, query_type=drizzled::QT_ORDINARY) at drizzled/sql_select.cc:6592

Bug #608416 reported by Patrick Crews
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Drizzle
Fix Released
Undecided
PrafullaT
Dexter
Fix Released
Undecided
PrafullaT

Bug Description

Crashing bug detected in randgen test optimizer_subquery:
"void drizzled::Select_Lex::print(drizzled::Session*, drizzled::String*, drizzled::enum_query_type)") at assert.c:81
#3 0x00000000006282fb in drizzled::Select_Lex::print (this=0x3911418, session=0x0, str=0x7f26b77fd7c0, query_type=drizzled::QT_ORDINARY)
    at drizzled/sql_select.cc:6592

Working on a test case for the test suite.

Randgen command line:
./gentest.pl --dsn=dbi:drizzle:host=localhost:port=9306:user=root:password=:database=test --threads=5 --queries=1000 --engine=Innodb --gendata=conf/drizzle/drizzle.zz --grammar=conf/drizzle/optimizer_subquery_drizzle.yy --validators=SelectStability

Backtrace:
#0 0x00007f26d23f3a75 in *__GI_raise (sig=<value optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#1 0x00007f26d23f75c0 in *__GI_abort () at abort.c:92
#2 0x00007f26d23ec941 in *__GI___assert_fail (assertion=0x88775b "session", file=<value optimized out>, line=6592,
    function=0x8878e0 "void drizzled::Select_Lex::print(drizzled::Session*, drizzled::String*, drizzled::enum_query_type)") at assert.c:81
#3 0x00000000006282fb in drizzled::Select_Lex::print (this=0x3911418, session=0x0, str=0x7f26b77fd7c0, query_type=drizzled::QT_ORDINARY)
    at drizzled/sql_select.cc:6592
#4 0x0000000000587b03 in drizzled::Item_subselect::print (this=0x3912c08, str=0x7f26b77fd7c0, query_type=6) at drizzled/item/subselect.cc:396
#5 0x000000000052be6c in drizzled::Item_func::print_op (this=0x3912d40, str=0x7f26b77fd7c0, query_type=drizzled::QT_ORDINARY)
    at drizzled/function/func.cc:406
#6 0x000000000062803d in drizzled::Select_Lex::print (this=0x3a27c28, session=0x3a26f80, str=0x7f26b77fd7c0, query_type=drizzled::QT_ORDINARY)
    at drizzled/sql_select.cc:6682
#7 0x000000000061420f in drizzled::Select_Lex_Unit::print (this=0x3a27a28, str=0x7f26b77fd7c0, query_type=drizzled::QT_ORDINARY)
    at drizzled/sql_lex.cc:1722
#8 0x000000000061d7b1 in drizzled::execute_sqlcom_select (session=0x3a26f80, all_tables=0x3a2a720) at drizzled/sql_parse.cc:528
#9 0x000000000061d29e in mysql_execute_command (session=0x3a26f80, inBuf=<value optimized out>, length=<value optimized out>) at drizzled/sql_parse.cc:478
#10 drizzled::mysql_parse (session=0x3a26f80, inBuf=<value optimized out>, length=<value optimized out>) at drizzled/sql_parse.cc:737
#11 0x000000000061f4d2 in drizzled::dispatch_command (command=drizzled::COM_QUERY, session=0x3a26f80, packet=0x3ab0f21 "",
    packet_length=<value optimized out>) at drizzled/sql_parse.cc:223
#12 0x00000000005ef9bf in drizzled::Session::executeStatement (this=0x3a26f80) at drizzled/session.cc:648
#13 0x00000000005f1f22 in drizzled::Session::run (this=0x3a26f80) at drizzled/session.cc:505
#14 0x00007f26ce96f024 in MultiThreadScheduler::runSession (arg=<value optimized out>) at ./plugin/multi_thread/multi_thread.h:67
#15 session_thread (arg=<value optimized out>) at plugin/multi_thread/multi_thread.cc:43
#16 0x00007f26d27499ca in start_thread (arg=<value optimized out>) at pthread_create.c:300
#17 0x00007f26d24a66fd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#18 0x0000000000000000 in ?? ()

Revision history for this message
Patrick Crews (patrick-crews) wrote :

Failing query:
EXPLAIN EXTENDED SELECT table2 . `col_enum_not_null_key` AS field1 , table1 . `col_char_1024_key` AS field2 FROM ( ( SELECT SUBQUERY1_t1 . * FROM ( BB AS SUBQUERY1_t1 RIGHT JOIN AA AS SUBQUERY1_t2 ON (SUBQUERY1_t2 . `col_int_not_null_key` = SUBQUERY1_t1 . `col_int_key` ) ) ) AS table1 INNER JOIN ( ( DD AS table2 STRAIGHT_JOIN BB AS table3 ON (table3 . `col_char_10_not_null_key` = table2 . `col_char_key` ) ) ) ON (table3 . `col_char_key` = table2 . `col_text_not_null` ) ) WHERE ( ( SELECT MIN( SUBQUERY2_t2 . `col_char_10_not_null_key` ) AS SUBQUERY2_field1 FROM AA AS SUBQUERY2_t1 WHERE ( EXISTS ( ( SELECT CHILD_SUBQUERY1_t2 . `col_char_10_not_null_key` AS CHILD_SUBQUERY1_field1 FROM ( BB AS CHILD_SUBQUERY1_t1 INNER JOIN AA AS CHILD_SUBQUERY1_t2 ON (CHILD_SUBQUERY1_t2 . `col_int_key` = CHILD_SUBQUERY1_t1 . `pk` ) ) WHERE ( CHILD_SUBQUERY1_t2 . `col_char_10_not_null_key` > 'y' AND CHILD_SUBQUERY1_t1 . `col_int_not_null_key` = CHILD_SUBQUERY1_t1 . `col_int_not_null` ) HAVING CHILD_SUBQUERY1_t2 . `col_bigint_key` >= 3) ) AND SUBQUERY2_t1 . `col_int_key` != 8 ) ) IS NOT NULL ) AND ( table1 . `col_int_key` = 160 AND table1 . `col_int_key` = 197 ) AND table3 . `col_text_not_null` >= 'g' GROUP BY field1, field2

Revision history for this message
Patrick Crews (patrick-crews) wrote :
Download full text (10.7 KiB)

Test case:
--test-run --record <whatever_you_name_this>

--echo Bug#608416
--echo Crash / assertion failed -
--echo "void drizzled::Select_Lex::print(drizzled::Session*, drizzled::String*, drizzled::enum_query_type)") at assert.c:81
--echo #3 0x00000000006282fb in drizzled::Select_Lex::print
--echo (this=0x3911418, session=0x0, str=0x7f26b77fd7c0, query_type=drizzled::QT_ORDINARY) at drizzled/sql_select.cc:6592

--disable_warnings
DROP TABLE IF EXISTS `aa`,`bb`,`dd`;
--enable_warnings

DROP TABLE IF EXISTS `aa`;
CREATE TABLE `aa` (
  `pk` int NOT NULL AUTO_INCREMENT,
  `col_enum_not_null_key` enum('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z') NOT NULL,
  `col_int_not_null_key` int NOT NULL,
  `col_char_10_not_null_key` varchar(10) NOT NULL,
  `col_int_key` int DEFAULT NULL,
  `col_text_not_null` text NOT NULL,
  `col_char_1024_key` varchar(1024) DEFAULT NULL,
  `col_bigint_key` bigint DEFAULT NULL,
  `col_int_not_null` int NOT NULL,
  PRIMARY KEY (`pk`),
  KEY `col_enum_not_null_key` (`col_enum_not_null_key`),
  KEY `col_int_not_null_key` (`col_int_not_null_key`),
  KEY `col_char_10_not_null_key` (`col_char_10_not_null_key`),
  KEY `col_int_key` (`col_int_key`),
  KEY `col_char_1024_key` (`col_char_1024_key`(255)),
  KEY `col_bigint_key` (`col_bigint_key`)
) ENGINE=InnoDB;

INSERT INTO `aa` VALUES (1,'s',-523436032,'at',2071265280,'','LPUJD',NULL,-1974206464),(2,'p',1,'VDMDI',1,'','don\'t',NULL,3),(3,'n',621543424,'WPTIG',NULL,'','think',-2842897264777625600,-274595840),(4,'o',880148480,'your',1734213632,'','on',NULL,295501824),(5,'b',1963982848,'q',1505558528,'','YTUNQ',3557843705622691840,9),(6,'c',8,'OOQXU',8,'','o',-4628011567076605952,2),(7,'p',1445462016,'RDODX',NULL,'','so',-5755881798756204544,-1601306624),(8,'i',0,'e',-1685520384,'','get',NULL,-1770323968),(9,'f',-747241472,'FEKXH',NULL,'','l',NULL,256311296),(10,'p',6,'GTHOM',-1431502848,'','h',-5719290051783819264,4);

CREATE TABLE `bb` (
  `col_enum_not_null_key` enum('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z') NOT NULL,
  `col_text_not_null` text NOT NULL,
  `col_char_10_not_null_key` varchar(10) NOT NULL,
  `col_bigint_key` bigint DEFAULT NULL,
  `col_char_1024_key` varchar(1024) DEFAULT NULL,
  `pk` int NOT NULL AUTO_INCREMENT,
  `col_int_not_null_key` int NOT NULL,
  `col_int_key` int DEFAULT NULL,
  `col_int_not_null` int NOT NULL,
  PRIMARY KEY (`pk`),
  KEY `col_enum_not_null_key` (`col_enum_not_null_key`),
  KEY `col_char_10_not_null_key` (`col_char_10_not_null_key`),
  KEY `col_bigint_key` (`col_bigint_key`),
  KEY `col_char_1024_key` (`col_char_1024_key`(255)),
  KEY `col_int_not_null_key` (`col_int_not_null_key`),
  KEY `col_int_key` (`col_int_key`)
) ENGINE=InnoDB;

INSERT INTO `bb` VALUES ('r','','DCJRX',NULL,'ANVSO',1,1,NULL,763953152),('a','','x',NULL,'JBJPT',2,1,4,-132513792),('s','','ZMHDL',-647673921411219456,'KAHJT',3,-1536425984,-628359168,3),('i','','SJGHS',-5702401553181179904,'q',4,-1443495936,-2114322432,-1349844992),('w','','his',NULL,'l',5,2,105971712,-2019688448),('v','','m',4,'ULWFL',6,0,2,-38207488),('d','','i',NULL,'YOIXU',7,8...

Revision history for this message
Patrick Crews (patrick-crews) wrote :

This crashes only with EXPLAIN EXTENDED. Otherwise, we should see:
failed: 1054: Unknown column 'SUBQUERY2_t2.col_char_10_not_null_key' in 'field list'

Changed in drizzle:
status: New → Confirmed
Revision history for this message
Patrick Crews (patrick-crews) wrote :

Possibly related?
http://<email address hidden>/msg02304.html

Revision history for this message
PrafullaT (prafulla-t) wrote :

Hi Patrick,
I have pushed fix for this bug at linked branch.
Could you please take a look ?

--
Thanks
Prafulla

Changed in drizzle:
assignee: nobody → Prafulla Tekawade (prafulla-tekawade)
PrafullaT (prafulla-t)
Changed in drizzle:
status: Confirmed → Fix Committed
Revision history for this message
Patrick Crews (patrick-crews) wrote :

Tested the patch with the randgen (result set + execution time comparisons).
Bug is fixed via the patch - randgen testing looked good.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.