Server crash with mysql_execute() (4.1)

Server crash with mysql_execute() (4.1)

am 10.01.2003 16:30:46 von Georg Richter

Hi,

how-to-repeat:

When the table defnition changes between mysql_bind() and mysql_execute()
server crashes:


....
if (mysql_bind_param(stmt, bind))
{
fprintf(stderr, "\n bind_result failed");
fprintf(stderr, "\n Error: %s", mysql_stmt_error(stmt));
exit(0);
}

/* do anything here, and an another process changes the table
definition: e.g. ALTER table test_table change b b int
For testing set a breakpoint to next line, change the table definition
and continue.
*/

int_data = 1234;
strcpy(str_data, "MySQL");

/* Now fetch data to buffers */
if (mysql_execute(stmt))
{
fprintf(stderr, "\n execute failed");
fprintf(stderr, "\n %s\n", mysql_stmt_error(stmt));
exit(0);
}


Stack-Trace:

0x80f1b6b handle_segfault + 447
0x40047bc4 _end + 935296684
0x80edef7 get_lock_data(THD *, st_table **, unsigned int, bool, st_table **)
+ 67
0x80ed818 mysql_lock_tables(THD *, st_table **, unsigned int) + 408
0x811379c lock_tables(THD *, st_table_list *) + 112
0x8113711 open_and_lock_tables(THD *, st_table_list *) + 41
0x812a8ad mysql_insert(THD *, st_table_list *, List &, List
> &, List &, List &, enum_duplicates) + 453
0x80fef7e mysql_execute_command(THD *) + 7650
0x812f13a mysql_stmt_execute(THD *, char *) + 274
0x80fc500 dispatch_command(enum_server_command, THD *, char *, unsigned int)
+ 1524
0x80fbeff do_command(THD *) + 411
0x80fb587 handle_one_connection + 727
0x40044f37 _end + 935285279
0x401a0baa _end + 936709778

Regards

Georg


------------------------------------------------------------ ---------
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-thread13454@lists.mysql.com
To unsubscribe, e-mail

Re: Server crash with mysql_execute() (4.1)

am 11.01.2003 05:39:47 von Venu

On Fri, 2003-01-10 at 07:30, Georg Richter wrote:
> Hi,
>
> how-to-repeat:
>
> When the table defnition changes between mysql_bind() and mysql_execute()
> server crashes:
>
>
> ....
> if (mysql_bind_param(stmt, bind))
> {
> fprintf(stderr, "\n bind_result failed");
> fprintf(stderr, "\n Error: %s", mysql_stmt_error(stmt));
> exit(0);
> }
>
> /* do anything here, and an another process changes the table
> definition: e.g. ALTER table test_table change b b int
> For testing set a breakpoint to next line, change the table definition
> and continue.
> */
>
> int_data = 1234;
> strcpy(str_data, "MySQL");
>
> /* Now fetch data to buffers */
> if (mysql_execute(stmt))
> {
> fprintf(stderr, "\n execute failed");
> fprintf(stderr, "\n %s\n", mysql_stmt_error(stmt));
> exit(0);
> }
>
>
> Stack-Trace:
>
> 0x80f1b6b handle_segfault + 447
> 0x40047bc4 _end + 935296684
> 0x80edef7 get_lock_data(THD *, st_table **, unsigned int, bool, st_table **)
> + 67
> 0x80ed818 mysql_lock_tables(THD *, st_table **, unsigned int) + 408
> 0x811379c lock_tables(THD *, st_table_list *) + 112
> 0x8113711 open_and_lock_tables(THD *, st_table_list *) + 41
> 0x812a8ad mysql_insert(THD *, st_table_list *, List &, List
> > &, List &, List &, enum_duplicates) + 453
> 0x80fef7e mysql_execute_command(THD *) + 7650
> 0x812f13a mysql_stmt_execute(THD *, char *) + 274
> 0x80fc500 dispatch_command(enum_server_command, THD *, char *, unsigned int)
> + 1524
> 0x80fbeff do_command(THD *) + 411
> 0x80fb587 handle_one_connection + 727
> 0x40044f37 _end + 935285279
> 0x401a0baa _end + 936709778

Georg;

Thanks for the bug-report, and I could able to reproduce it. Let you
know when its fixed.

This is happening only if the call is ALTER table which changes the
table schema, and doesn't with any other calls.

Thanks

--
Regards, Venu
For technical support contracts, go to https://order.mysql.com
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Mr. Venu
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB, Developer
/_/ /_/\_, /___/\___\_\___/ Palo Alto, CA-94306, USA
<___/ www.mysql.com

Join MySQL Users Conference and Expo:
http://www.mysql.com/events/uc2003/


------------------------------------------------------------ ---------
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-thread13457@lists.mysql.com
To unsubscribe, e-mail

Re: Server crash with mysql_execute() (4.1)

am 11.01.2003 09:41:47 von Georg Richter

On Saturday 11 January 2003 05:39, Venu wrote:
>
> This is happening only if the call is ALTER table which changes the
> table schema, and doesn't with any other calls.

One other problem (dunno if it's fixed with your latest fix):

instead of ALTER TABLE try LOCK TABLES test_table READ; (thread 2)

then execute mysql_execute (thread 1)

then try UNLOCK TABLES; (thread 2).

And both threads are hanging (deadock?!).

Regards

Georg

------------------------------------------------------------ ---------
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-thread13459@lists.mysql.com
To unsubscribe, e-mail

Re: Server crash with mysql_execute() (4.1)

am 11.01.2003 09:45:47 von Venu

On Fri, 2003-01-10 at 07:30, Georg Richter wrote:
> Hi,
>
> how-to-repeat:
>
> When the table defnition changes between mysql_bind() and mysql_execute()
> server crashes:
>
>
> ....
> if (mysql_bind_param(stmt, bind))
> {
> fprintf(stderr, "\n bind_result failed");
> fprintf(stderr, "\n Error: %s", mysql_stmt_error(stmt));
> exit(0);
> }
>
> /* do anything here, and an another process changes the table
> definition: e.g. ALTER table test_table change b b int
> For testing set a breakpoint to next line, change the table definition
> and continue.
> */
>
> int_data = 1234;
> strcpy(str_data, "MySQL");
>
> /* Now fetch data to buffers */
> if (mysql_execute(stmt))
> {
> fprintf(stderr, "\n execute failed");
> fprintf(stderr, "\n %s\n", mysql_stmt_error(stmt));
> exit(0);
> }
>
>
> Stack-Trace:
>
> 0x80f1b6b handle_segfault + 447
> 0x40047bc4 _end + 935296684
> 0x80edef7 get_lock_data(THD *, st_table **, unsigned int, bool, st_table **)
> + 67
> 0x80ed818 mysql_lock_tables(THD *, st_table **, unsigned int) + 408
> 0x811379c lock_tables(THD *, st_table_list *) + 112
> 0x8113711 open_and_lock_tables(THD *, st_table_list *) + 41
> 0x812a8ad mysql_insert(THD *, st_table_list *, List &, List
> > &, List &, List &, enum_duplicates) + 453
> 0x80fef7e mysql_execute_command(THD *) + 7650
> 0x812f13a mysql_stmt_execute(THD *, char *) + 274
> 0x80fc500 dispatch_command(enum_server_command, THD *, char *, unsigned int)
> + 1524
> 0x80fbeff do_command(THD *) + 411
> 0x80fb587 handle_one_connection + 727
> 0x40044f37 _end + 935285279
> 0x401a0baa _end + 936709778

Fixed, the fix is available from the latest BK source.

Thanks for the bug report !


PS : Also, I committed the prepared statements document prepare.texi to
Docs dir (The same copy of html version that you have), with minor
fixups.

--
Regards, Venu
For technical support contracts, go to https://order.mysql.com
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Mr. Venu
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB, Developer
/_/ /_/\_, /___/\___\_\___/ Palo Alto, CA-94306, USA
<___/ www.mysql.com

Join MySQL Users Conference and Expo:
http://www.mysql.com/events/uc2003/


------------------------------------------------------------ ---------
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-thread13458@lists.mysql.com
To unsubscribe, e-mail

Re: Server crash with mysql_execute() (4.1)

am 11.01.2003 10:49:21 von Venu

On Sat, 2003-01-11 at 00:41, Georg Richter wrote:
> On Saturday 11 January 2003 05:39, Venu wrote:
> >
> > This is happening only if the call is ALTER table which changes the
> > table schema, and doesn't with any other calls.
>
> One other problem (dunno if it's fixed with your latest fix):
>
> instead of ALTER TABLE try LOCK TABLES test_table READ; (thread 2)
>
> then execute mysql_execute (thread 1)
>
> then try UNLOCK TABLES; (thread 2).
>
> And both threads are hanging (deadock?!).

I don't see this anymore with the fix. But, when I reverted the fix, I
could see the deadlock.


Thanks

--
Regards, Venu
For technical support contracts, go to https://order.mysql.com
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Mr. Venu
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB, Developer
/_/ /_/\_, /___/\___\_\___/ Palo Alto, CA-94306, USA
<___/ www.mysql.com

Join MySQL Users Conference and Expo:
http://www.mysql.com/events/uc2003/


------------------------------------------------------------ ---------
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-thread13460@lists.mysql.com
To unsubscribe, e-mail