Crash with "big" derivated table in MySQL-4.1

Crash with "big" derivated table in MySQL-4.1

am 14.11.2002 20:04:27 von Jocelyn Fournier

Hi,

MySQL-4.1 crashes if we try to create a too big derivated table.

How-to-repeat :

SELECT * FROM (SELECT * FROM forumconthardwarefr7) ORDER BY numeropost ASC
LIMIT 0,20;
ERROR 2013: Lost connection to MySQL server during query

Stack trace :

0x80a26a1 handle_segfault(int) + 481
0x8287f28 pthread_sighandler + 176
0x8244681 mi_create + 321
0x80d0e82 create_myisam_tmp_table(st_table*, TMP_TABLE_PARAM*, unsigned
long) + 258
0x80cdb65 create_myisam_from_heap(st_table*, TMP_TABLE_PARAM*, int, bool) +
245
0x8138315 select_union::send_data(List&) + 117
0x80d6ab2 end_send(JOIN*, st_join_table*, bool) + 338
0x80d5bb6 sub_select(JOIN*, st_join_table*, bool) + 246
0x80d12d1 do_select(JOIN*, List*, st_table*, Procedure*) + 257
0x80cb5a8 JOIN::exec() + 2968
0x80cbc5b mysql_select(THD*, st_table_list*, List&, Item*, st_order*,
st_order*, Item*, st_order*, unsigned long, select_result*,
st_select_lex_unit*, st_select_lex*) + 123
0x8139432 mysql_derived(THD*, st_lex*, st_select_lex_unit*, st_table_list*)
+ 1266
0x80b0e14 mysql_execute_command(THD*) + 18100
0x80b1912 mysql_parse(THD*, char*, unsigned) + 146
0x80ab8e7 dispatch_command(enum_server_command, THD*, char*, unsigned) + 855
0x80ab576 do_command(THD*) + 118
0x80aae4f handle_one_connection(void*) + 895
0x82857ba pthread_start_thread + 218
0x82b9c6a thread_start + 4

forumconthardwarefr7 table is uploaded here (it contains 100000 rows) :

ftp://support.mysql.com/pub/mysql/secret/derivated_crash.tar .gz

Regards,
Jocelyn


------------------------------------------------------------ ---------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)

To request this thread, e-mail bugs-thread12990@lists.mysql.com
To unsubscribe, e-mail

Re: Crash with "big" derivated table in MySQL-4.1

am 14.11.2002 20:45:33 von Sinisa Milivojevic

Jocelyn Fournier writes:
> Hi,
>
> MySQL-4.1 crashes if we try to create a too big derivated table.
>
> How-to-repeat :
>
> SELECT * FROM (SELECT * FROM forumconthardwarefr7) ORDER BY numeropost ASC
> LIMIT 0,20;
> ERROR 2013: Lost connection to MySQL server during query
>
> Stack trace :
>
> forumconthardwarefr7 table is uploaded here (it contains 100000 rows) :
>
> ftp://support.mysql.com/pub/mysql/secret/derivated_crash.tar .gz
>
> Regards,
> Jocelyn


Thank you so much.


I will take a look at it tomorrow. I am already downloding your table.

For the record, these are derived and not derivated tables ... ;)

--
Regards,
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Mr. Sinisa Milivojevic
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB, Fulltime Developer
/_/ /_/\_, /___/\___\_\___/ Larnaca, Cyprus
<___/ www.mysql.com


------------------------------------------------------------ ---------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)

To request this thread, e-mail bugs-thread12991@lists.mysql.com
To unsubscribe, e-mail

Re: Crash with "big" derivated table in MySQL-4.1

am 15.11.2002 18:54:16 von Sinisa Milivojevic

Jocelyn Fournier writes:
> Hi,
>
> MySQL-4.1 crashes if we try to create a too big derivated table.
>
> How-to-repeat :
>
> SELECT * FROM (SELECT * FROM forumconthardwarefr7) ORDER BY numeropost ASC
> LIMIT 0,20;
> ERROR 2013: Lost connection to MySQL server during query
>
>
> Regards,
> Jocelyn

Thank you for your bug report, which helped us fix few bugs in derived
tables code.

This is a patch that fixes the error:


===== sql/sql_derived.cc 1.14 vs edited =====
*** /tmp/sql_derived.cc-1.14-9183 Tue Nov 12 14:40:27 2002
--- edited/sql/sql_derived.cc Fri Nov 15 19:34:33 2002
***************
*** 88,93 ****
--- 88,94 ----

if ((derived_result=new select_union(table)))
{
+ derived_result->tmp_table_param=&tmp_table_param;
unit->offset_limit_cnt= sl->offset_limit;
unit->select_limit_cnt= sl->select_limit+sl->offset_limit;
if (unit->select_limit_cnt < sl->select_limit)
***************
*** 118,124 ****
table->tmp_table=TMP_TABLE;
if (!lex->describe)
sl->exclude();
! t->db="";
t->derived=(SELECT_LEX *)0; // just in case ...
}
}
--- 119,125 ----
table->tmp_table=TMP_TABLE;
if (!lex->describe)
sl->exclude();
! t->db=(char *)"";
t->derived=(SELECT_LEX *)0; // just in case ...
}
}
===== sql/sql_union.cc 1.45 vs edited =====
*** /tmp/sql_union.cc-1.45-9185 Wed Oct 30 13:18:46 2002
--- edited/sql/sql_union.cc Fri Nov 15 19:50:02 2002
***************
*** 80,85 ****
--- 80,86 ----
{
if (create_myisam_from_heap(table, tmp_table_param, info.last_errno, 0))
return 1;
+ thd->net.report_error=0; // donno why does it work, but it does ...
}
return 0;
}

--
Regards,
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Mr. Sinisa Milivojevic
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB, Fulltime Developer
/_/ /_/\_, /___/\___\_\___/ Larnaca, Cyprus
<___/ www.mysql.com


------------------------------------------------------------ ---------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)

To request this thread, e-mail bugs-thread13002@lists.mysql.com
To unsubscribe, e-mail

Re: Crash with "big" derivated table in MySQL-4.1

am 15.11.2002 19:01:02 von Jocelyn Fournier

Hi,

Thanks for the patch.
This afternoon I hit a strange problem :

I issue this query several time :

SELECT * FROM (SELECT * FROM online) ORDER BY numeropost ASC
and
EXPLAIN SELECT * FROM (SELECT * FROM online) ORDER BY numeropost ASC

With "online" as an HEAP table.
After several successfull try, I finally locked mysql monitor.
Show processlist was displaying all queries on online table in "locked"
state, and two queries on online table in "waiting for table" state. (sound
like the INSERT DELAYED bug behaviour in fact)
I've not been able to reproduce the bug. All I can say is that operation on
the online table are INSERT, REPLACE and DELETE.
Perhaps a mutex is missing or something like that ?

Regards,
Jocelyn

----- Original Message -----
From: "Sinisa Milivojevic"
To:
Cc:
Sent: Friday, November 15, 2002 5:54 PM
Subject: Re: Crash with 'big' derivated table in MySQL-4.1


> Jocelyn Fournier writes:
> > Hi,
> >
> > MySQL-4.1 crashes if we try to create a too big derivated table.
> >
> > How-to-repeat :
> >
> > SELECT * FROM (SELECT * FROM forumconthardwarefr7) ORDER BY numeropost
ASC
> > LIMIT 0,20;
> > ERROR 2013: Lost connection to MySQL server during query
> >
> >
> > Regards,
> > Jocelyn
>
> Thank you for your bug report, which helped us fix few bugs in derived
> tables code.
>
> This is a patch that fixes the error:
>
>
> ===== sql/sql_derived.cc 1.14 vs edited =====
> *** /tmp/sql_derived.cc-1.14-9183 Tue Nov 12 14:40:27 2002
> --- edited/sql/sql_derived.cc Fri Nov 15 19:34:33 2002
> ***************
> *** 88,93 ****
> --- 88,94 ----
>
> if ((derived_result=new select_union(table)))
> {
> + derived_result->tmp_table_param=&tmp_table_param;
> unit->offset_limit_cnt= sl->offset_limit;
> unit->select_limit_cnt= sl->select_limit+sl->offset_limit;
> if (unit->select_limit_cnt < sl->select_limit)
> ***************
> *** 118,124 ****
> table->tmp_table=TMP_TABLE;
> if (!lex->describe)
> sl->exclude();
> ! t->db="";
> t->derived=(SELECT_LEX *)0; // just in case ...
> }
> }
> --- 119,125 ----
> table->tmp_table=TMP_TABLE;
> if (!lex->describe)
> sl->exclude();
> ! t->db=(char *)"";
> t->derived=(SELECT_LEX *)0; // just in case ...
> }
> }
> ===== sql/sql_union.cc 1.45 vs edited =====
> *** /tmp/sql_union.cc-1.45-9185 Wed Oct 30 13:18:46 2002
> --- edited/sql/sql_union.cc Fri Nov 15 19:50:02 2002
> ***************
> *** 80,85 ****
> --- 80,86 ----
> {
> if (create_myisam_from_heap(table, tmp_table_param, info.last_errno,
0))
> return 1;
> + thd->net.report_error=0; // donno why does it work, but it does ...
> }
> return 0;
> }
>
> --
> Regards,
> __ ___ ___ ____ __
> / |/ /_ __/ __/ __ \/ / Mr. Sinisa Milivojevic
> / /|_/ / // /\ \/ /_/ / /__ MySQL AB, Fulltime Developer
> /_/ /_/\_, /___/\___\_\___/ Larnaca, Cyprus
> <___/ www.mysql.com
>
>
> ------------------------------------------------------------ ---------
> Before posting, please check:
> http://www.mysql.com/manual.php (the manual)
> http://lists.mysql.com/ (the list archive)
>
> To request this thread, e-mail bugs-thread13002@lists.mysql.com
> To unsubscribe, e-mail
>
>
>
>


------------------------------------------------------------ ---------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)

To request this thread, e-mail bugs-thread13004@lists.mysql.com
To unsubscribe, e-mail

Re: Crash with "big" derivated table in MySQL-4.1

am 15.11.2002 19:18:42 von Sinisa Milivojevic

Jocelyn Fournier writes:
> Hi,
>
> Thanks for the patch.
> This afternoon I hit a strange problem :
>
> I issue this query several time :
>
> SELECT * FROM (SELECT * FROM online) ORDER BY numeropost ASC
> and
> EXPLAIN SELECT * FROM (SELECT * FROM online) ORDER BY numeropost ASC
>
> With "online" as an HEAP table.
> After several successfull try, I finally locked mysql monitor.
> Show processlist was displaying all queries on online table in "locked"
> state, and two queries on online table in "waiting for table" state. (sound
> like the INSERT DELAYED bug behaviour in fact)
> I've not been able to reproduce the bug. All I can say is that operation on
> the online table are INSERT, REPLACE and DELETE.
> Perhaps a mutex is missing or something like that ?
>
> Regards,
> Jocelyn

Hi!

I have run the above queries in a script with your MyISAM table that
you have sent us, but I was not able to reproduce the error.

We truly need a repeatable test case, and you are very capable of
providing the one.

Were you running delayed inserts on the HEAP table ???

--
Regards,
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Mr. Sinisa Milivojevic
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB, Fulltime Developer
/_/ /_/\_, /___/\___\_\___/ Larnaca, Cyprus
<___/ www.mysql.com


------------------------------------------------------------ ---------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)

To request this thread, e-mail bugs-thread13005@lists.mysql.com
To unsubscribe, e-mail

Re: Crash with "big" derivated table in MySQL-4.1

am 15.11.2002 19:49:14 von Jocelyn Fournier

No, no delayed insert on heap table ;)
I was just saying the resulting behaviour of this bug is quite like the bug
with DELAYED thread + SIGHUP (queries locked in waiting for table state).
I will investigate and tell you if I can grab more clues about this bug.

Regards,
Jocelyn

----- Original Message -----
From: "Sinisa Milivojevic"
To:
Cc:
Sent: Friday, November 15, 2002 6:18 PM
Subject: Re: Crash with 'big' derivated table in MySQL-4.1


> Jocelyn Fournier writes:
> > Hi,
> >
> > Thanks for the patch.
> > This afternoon I hit a strange problem :
> >
> > I issue this query several time :
> >
> > SELECT * FROM (SELECT * FROM online) ORDER BY numeropost ASC
> > and
> > EXPLAIN SELECT * FROM (SELECT * FROM online) ORDER BY numeropost ASC
> >
> > With "online" as an HEAP table.
> > After several successfull try, I finally locked mysql monitor.
> > Show processlist was displaying all queries on online table in "locked"
> > state, and two queries on online table in "waiting for table" state.
(sound
> > like the INSERT DELAYED bug behaviour in fact)
> > I've not been able to reproduce the bug. All I can say is that operation
on
> > the online table are INSERT, REPLACE and DELETE.
> > Perhaps a mutex is missing or something like that ?
> >
> > Regards,
> > Jocelyn
>
> Hi!
>
> I have run the above queries in a script with your MyISAM table that
> you have sent us, but I was not able to reproduce the error.
>
> We truly need a repeatable test case, and you are very capable of
> providing the one.
>
> Were you running delayed inserts on the HEAP table ???
>
> --
> Regards,
> __ ___ ___ ____ __
> / |/ /_ __/ __/ __ \/ / Mr. Sinisa Milivojevic
> / /|_/ / // /\ \/ /_/ / /__ MySQL AB, Fulltime Developer
> /_/ /_/\_, /___/\___\_\___/ Larnaca, Cyprus
> <___/ www.mysql.com
>
>
>
>


------------------------------------------------------------ ---------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)

To request this thread, e-mail bugs-thread13006@lists.mysql.com
To unsubscribe, e-mail

Re: Crash with "big" derivated table in MySQL-4.1

am 15.11.2002 20:08:00 von Sinisa Milivojevic

Jocelyn Fournier writes:
> No, no delayed insert on heap table ;)
> I was just saying the resulting behaviour of this bug is quite like the bug
> with DELAYED thread + SIGHUP (queries locked in waiting for table state).
> I will investigate and tell you if I can grab more clues about this bug.
>
> Regards,
> Jocelyn
>

Thanks for clearing this out.

We can try to reproduce it on HEAP table by running a script with
INSERT,UPDATE, DELETE and SELECT's you described.

If you can come up with some additional instructions, that would be
nice ...;)

--
Regards,
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Mr. Sinisa Milivojevic
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB, Fulltime Developer
/_/ /_/\_, /___/\___\_\___/ Larnaca, Cyprus
<___/ www.mysql.com


------------------------------------------------------------ ---------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)

To request this thread, e-mail bugs-thread13007@lists.mysql.com
To unsubscribe, e-mail