selecting transaction_log record that does not exist crashes server

Bug #616941 reported by Joe Daly
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Drizzle
Fix Released
Medium
David Shrewsbury
7.0
Fix Released
Medium
David Shrewsbury

Bug Description

starting the server with --transaction_log_enable and selecting a transaction log entry that does not exist will crash the server

jdaly@rx7:~/drizzle/repos/transaction_log_599582/tests$ ../client/drizzle --user=root --port=9306
Welcome to the Drizzle client.. Commands end with ; or \g.
Your Drizzle connection id is 2
Server version: 2010.08.1689 Source distribution (transaction_log_599582)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

drizzle> use test;
Database changed
drizzle> CREATE TABLE t1(a INT NOT NULL AUTO_INCREMENT, b INT NOT NULL, PRIMARY KEY(a), KEY b_key1 (b));
Query OK, 0 rows affected (0.1 sec)

drizzle> SELECT PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(10) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS));

heres the stack:

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff5ca2014 in memcpy () from /lib/libc.so.6
(gdb) where
#0 0x00007ffff5ca2014 in memcpy () from /lib/libc.so.6
#1 0x00007ffff72425a6 in google::protobuf::io::CodedInputStream::ReadRaw (
    this=0xeee780, buffer=0x7fff221a4010, size=<value optimized out>)
    at /usr/include/bits/string3.h:52
#2 0x00007ffff0b7740e in PrintTransactionMessageFunction::val_str (
    this=0x1af89a8, str=0x7fffe052f050)
    at plugin/transaction_log/print_transaction_message.cc:139
#3 0x000000000067dfa5 in drizzled::Item::send (this=0x1af89a8,
    client=0x1aee190, buffer=0x7fffe052f050) at drizzled/item.cc:1339
#4 0x000000000079d855 in drizzled::select_send::send_data (this=0x1af8eb8,
    items=...) at ./drizzled/select_send.h:108
#5 0x00000000006d78e0 in drizzled::Join::exec (this=0x1b059a8)
    at drizzled/join.cc:1250
#6 0x000000000079e503 in drizzled::mysql_select (session=0x1af2630,
    rref_pointer_array=0x1af3490, tables=0x0, wild_num=0, fields=...,
    conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0,
    select_options=2147500032, result=0x1af8eb8, unit=0x1af30d8,
    select_lex=0x1af32d8) at drizzled/sql_select.cc:427
#7 0x000000000079ddd9 in drizzled::handle_select (session=0x1af2630,
    lex=0x1af30b8, result=0x1af8eb8, setup_tables_done_option=0)
    at drizzled/sql_select.cc:146
#8 0x000000000079a5eb in drizzled::execute_sqlcom_select (session=0x1af2630,
    all_tables=0x1af86f8) at drizzled/sql_parse.cc:543
---Type <return> to continue, or q <return> to quit---
#9 0x00000000007f2fd7 in drizzled::statement::Select::execute (this=0x1af9e60)
    at drizzled/statement/select.cc:32
#10 0x000000000079a188 in mysql_execute_command (session=0x1af2630)
    at drizzled/sql_parse.cc:478
#11 0x000000000079ae7e in drizzled::mysql_parse (session=0x1af2630,
    inBuf=0x1af9f78 "SELECT PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(10) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS))", length=118)
    at drizzled/sql_parse.cc:737
#12 0x0000000000799b21 in drizzled::dispatch_command (
    command=drizzled::COM_QUERY, session=0x1af2630, packet=0x1aee621 "",
    packet_length=118) at drizzled/sql_parse.cc:223
#13 0x000000000075ea37 in drizzled::Session::executeStatement (this=0x1af2630)
    at drizzled/session.cc:648
#14 0x000000000075e335 in drizzled::Session::run (this=0x1af2630)
    at drizzled/session.cc:505
#15 0x00007ffff24a76c0 in MultiThreadScheduler::runSession (this=0x19bcf70,
    session=0x1af2630) at ./plugin/multi_thread/multi_thread.h:67
#16 0x00007ffff24a56d2 in session_thread (arg=0x1af2630)
    at plugin/multi_thread/multi_thread.cc:46
#17 0x00007ffff5fa49ca in start_thread () from /lib/libpthread.so.0
#18 0x00007ffff5d016fd in clone () from /lib/libc.so.6
#19 0x0000000000000000 in ?? ()

Related branches

Joe Daly (skinny.moey)
Changed in drizzle:
assignee: nobody → Joe Daly (skinny.moey)
Revision history for this message
Travis Davies (travisdaveez) wrote :

Hi Everyone,

I am hesitant to confirm this because of the:
'ERROR 1305 (42000): FUNCTION PRINT_TRANSACTION_MESSAGE does not exist' message.
I am thinking maybe I didn't do it right or I don't have something installed.

I gave this about 5 tries. 4 out of 5 of them resulted in the error mentioned above, and 1 resulted in:
drizzle_state_read:lost connection to server (EOF).

The following is what I see. Let me know what you think and if I should change the status.

Cheers!
Travis

// START THE SERVER:

[tdavies@Molly sbin]$ ls
drizzled
[tdavies@Molly sbin]$ ./drizzled --transaction-log.file ./myfile.
InnoDB: The InnoDB memory heap is disabled
InnoDB: Mutexes and rw_locks use GCC atomic builtins.
100906 13:22:30 InnoDB: highest supported file format is Barracuda.
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
100906 13:22:30 InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
100906 13:22:30 InnoDB Plugin 1.0.4 started; log sequence number 47142
Listening on 0.0.0.0:4427
Listening on :::4427
Listening on 0.0.0.0:3306
Listening on :::3306
./drizzled: Forcing close of thread 0 user: ''
./drizzled: ready for connections.
Version: '2010.09.1746' Source distribution (drizzle_latest)

// RUNNING COMMANDS:

drizzle> create database test;
Query OK, 1 row affected (0 sec)

drizzle> use test;
ERROR 1049 (42000): Unknown database 'testl'
drizzle> drop database test;
Query OK, 0 rows affected (0 sec)

drizzle> create database test;
Query OK, 1 row affected (0 sec)

drizzle> use test;
Database changed
drizzle> CREATE TABLE t1(a INT NOT NULL AUTO_INCREMENT, b INT NOT NULL, PRIMARY KEY(a), KEY b_key1 (b));
Query OK, 0 rows affected (0.04 sec)

drizzle> SELECT PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(10) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS));
ERROR 1305 (42000): FUNCTION PRINT_TRANSACTION_MESSAGE does not exist
drizzle>

// ON ANOTHER TRY...
// THIS HAPPENED ONCE, AND HAVE YET TO SEE IT AGAIN.
drizzle> use test;
Database changed
drizzle> SELECT PRINT_TRANSACTION_MESSAGE('myfile',(select max(10) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS));
ERROR:
drizzle_state_read:lost connection to server (EOF)
No connection. Trying to reconnect...
Connection id: 2
Current database: test

ERROR 1305 (42000): FUNCTION PRINT_TRANSACTION_MESSAGE does not exist
drizzle>

Revision history for this message
Patrick Crews (patrick-crews) wrote : Re: [Bug 616941] Re: selecting transaction_log record that does not exist crashes server
Download full text (6.9 KiB)

You should make sure that the transaction log plugin is enabled. Otherwise,
the log and the function noted below won't be available. You can check it
out via SHOW VARIABLES.

On Mon, Sep 6, 2010 at 7:03 PM, Travis Davies <email address hidden>wrote:

>
> Hi Everyone,
>
> I am hesitant to confirm this because of the:
> 'ERROR 1305 (42000): FUNCTION PRINT_TRANSACTION_MESSAGE does not exist'
> message.
> I am thinking maybe I didn't do it right or I don't have something
> installed.
>
> I gave this about 5 tries. 4 out of 5 of them resulted in the error
> mentioned above, and 1 resulted in:
> drizzle_state_read:lost connection to server (EOF).
>
> The following is what I see. Let me know what you think and if I should
> change the status.
>
> Cheers!
> Travis
>
>
> // START THE SERVER:
>
> [tdavies@Molly sbin]$ ls
> drizzled
> [tdavies@Molly sbin]$ ./drizzled --transaction-log.file ./myfile.
> InnoDB: The InnoDB memory heap is disabled
> InnoDB: Mutexes and rw_locks use GCC atomic builtins.
> 100906 13:22:30 InnoDB: highest supported file format is Barracuda.
> InnoDB: The log sequence number in ibdata files does not match
> InnoDB: the log sequence number in the ib_logfiles!
> 100906 13:22:30 InnoDB: Database was not shut down normally!
> InnoDB: Starting crash recovery.
> InnoDB: Reading tablespace information from the .ibd files...
> InnoDB: Restoring possible half-written data pages from the doublewrite
> InnoDB: buffer...
> 100906 13:22:30 InnoDB Plugin 1.0.4 started; log sequence number 47142
> Listening on 0.0.0.0:4427
> Listening on :::4427
> Listening on 0.0.0.0:3306
> Listening on :::3306
> ./drizzled: Forcing close of thread 0 user: ''
> ./drizzled: ready for connections.
> Version: '2010.09.1746' Source distribution (drizzle_latest)
>
>
>
> // RUNNING COMMANDS:
>
> drizzle> create database test;
> Query OK, 1 row affected (0 sec)
>
> drizzle> use test;
> ERROR 1049 (42000): Unknown database 'testl'
> drizzle> drop database test;
> Query OK, 0 rows affected (0 sec)
>
> drizzle> create database test;
> Query OK, 1 row affected (0 sec)
>
> drizzle> use test;
> Database changed
> drizzle> CREATE TABLE t1(a INT NOT NULL AUTO_INCREMENT, b INT NOT NULL,
> PRIMARY KEY(a), KEY b_key1 (b));
> Query OK, 0 rows affected (0.04 sec)
>
> drizzle> SELECT PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(10)
> from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS));
> ERROR 1305 (42000): FUNCTION PRINT_TRANSACTION_MESSAGE does not exist
> drizzle>
>
>
> // ON ANOTHER TRY...
> // THIS HAPPENED ONCE, AND HAVE YET TO SEE IT AGAIN.
> drizzle> use test;
> Database changed
> drizzle> SELECT PRINT_TRANSACTION_MESSAGE('myfile',(select max(10) from
> DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS));
> ERROR:
> drizzle_state_read:lost connection to server (EOF)
> No connection. Trying to reconnect...
> Connection id: 2
> Current database: test
>
> ERROR 1305 (42000): FUNCTION PRINT_TRANSACTION_MESSAGE does not exist
> drizzle>
>
> --
> selecting transaction_log record that does not exist crashes server
> https://bugs.launchpad.net/bugs/616941
> You received this bug notification because you are a member of Drizzle-
> developers, which is subscribed...

Read more...

Revision history for this message
David Shrewsbury (dshrews) wrote :

Hi Travis,

You need to start the server with --transaction-log.enable to enable
the transaction log,
then the function should be available to you.

-Dave

On Mon, Sep 6, 2010 at 7:03 PM, Travis Davies <email address hidden> wrote:
>
> Hi Everyone,
>
> I am hesitant to confirm this because of the:
> 'ERROR 1305 (42000): FUNCTION PRINT_TRANSACTION_MESSAGE does not exist' message.
> I am thinking maybe I didn't do it right or I don't have something installed.
>
> I gave this about 5 tries. 4 out of 5 of them resulted in the error mentioned above, and 1 resulted in:
> drizzle_state_read:lost connection to server (EOF).
>
> The following is what I see. Let me know what you think and if I should
> change the status.
>
> Cheers!
> Travis
>
>
> // START THE SERVER:
>
> [tdavies@Molly sbin]$ ls
> drizzled
> [tdavies@Molly sbin]$ ./drizzled --transaction-log.file ./myfile.
> InnoDB: The InnoDB memory heap is disabled
> InnoDB: Mutexes and rw_locks use GCC atomic builtins.
> 100906 13:22:30  InnoDB: highest supported file format is Barracuda.
> InnoDB: The log sequence number in ibdata files does not match
> InnoDB: the log sequence number in the ib_logfiles!
> 100906 13:22:30  InnoDB: Database was not shut down normally!
> InnoDB: Starting crash recovery.
> InnoDB: Reading tablespace information from the .ibd files...
> InnoDB: Restoring possible half-written data pages from the doublewrite
> InnoDB: buffer...
> 100906 13:22:30 InnoDB Plugin 1.0.4 started; log sequence number 47142
> Listening on 0.0.0.0:4427
> Listening on :::4427
> Listening on 0.0.0.0:3306
> Listening on :::3306
> ./drizzled: Forcing close of thread 0 user: ''
> ./drizzled: ready for connections.
> Version: '2010.09.1746' Source distribution (drizzle_latest)
>
>
>
> // RUNNING COMMANDS:
>
> drizzle> create database test;
> Query OK, 1 row affected (0 sec)
>
> drizzle> use test;
> ERROR 1049 (42000): Unknown database 'testl'
> drizzle> drop database test;
> Query OK, 0 rows affected (0 sec)
>
> drizzle> create database test;
> Query OK, 1 row affected (0 sec)
>
> drizzle> use test;
> Database changed
> drizzle> CREATE TABLE t1(a INT NOT NULL AUTO_INCREMENT, b INT NOT NULL, PRIMARY KEY(a), KEY b_key1 (b));
> Query OK, 0 rows affected (0.04 sec)
>
> drizzle> SELECT PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(10) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS));
> ERROR 1305 (42000): FUNCTION PRINT_TRANSACTION_MESSAGE does not exist
> drizzle>
>
>
> // ON ANOTHER TRY...
> // THIS HAPPENED ONCE, AND HAVE YET TO SEE IT AGAIN.
> drizzle> use test;
> Database changed
> drizzle> SELECT PRINT_TRANSACTION_MESSAGE('myfile',(select max(10) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS));
> ERROR:
> drizzle_state_read:lost connection to server (EOF)
> No connection. Trying to reconnect...
> Connection id:    2
> Current database: test
>
> ERROR 1305 (42000): FUNCTION PRINT_TRANSACTION_MESSAGE does not exist
> drizzle>
>
> --
> selecting transaction_log record that does not exist crashes server
> https://bugs.launchpad.net/bugs/616941
> You received this bug notification because you are a member of Drizzle-
> developers, which is subscribed to Drizzle.
>

Changed in drizzle:
status: New → Incomplete
Revision history for this message
Travis Davies (travisdaveez) wrote :

Bug confirmed.

// FROM CLIENT
drizzle> use test;
Database changed
drizzle> CREATE TABLE t1(a INT NOT NULL AUTO_INCREMENT, b INT NOT NULL, PRIMARY KEY(a), KEY b_key1 (b));
Query OK, 0 rows affected (0.08 sec)

drizzle> SELECT PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(10) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS));
ERROR:
drizzle_state_read:lost connection to server (EOF)
No connection. Trying to reconnect...
ERROR:
drizzle_state_connect:could not connect
ERROR:
Can't connect to the server

// FROM SERVER

./drizzled: Forcing close of thread 0 user: ''
./drizzled: ready for connections.
Version: '2010.09.1746' Source distribution (drizzle_latest)
100907 0:01:01 - drizzled 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.
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.

read_buffer_size=131072
max_used_connections=1
connection_count=1
It is possible that drizzled could use up to
(read_buffer_size + sort_buffer_size)*thread_count
bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Number of stack frames obtained: 21
[0xc93400]
/lib/libc.so.6(-0xff7ea8f9) [0x315707]
google::protobuf::io::CodedInputStream::ReadRaw(void*, int)
PrintTransactionMessageFunction::val_str(drizzled::String*)
drizzled::Item::send(drizzled::plugin::Client*, drizzled::String*)
drizzled::select_send::send_data(drizzled::List<drizzled::Item>&)
drizzled::Join::exec()
drizzled::mysql_select(drizzled::Session*, drizzled::Item***, drizzled::TableList*, unsigned int, drizzled::List<drizzled::Item>&, drizzled::Item*, unsigned int, drizzled::order_st*, drizzled::order_st*, drizzled::Item*, unsigned long long, drizzled::select_result*, drizzled::Select_Lex_Unit*, drizzled::Select_Lex*)
drizzled::handle_select(drizzled::Session*, drizzled::LEX*, drizzled::select_result*, unsigned long long)
drizzled::execute_sqlcom_select(drizzled::Session*, drizzled::TableList*)
drizzled::statement::Select::execute()
./drizzled() [0x83be11f]
drizzled::mysql_parse(drizzled::Session*, char const*, unsigned int)
drizzled::dispatch_command(drizzled::enum_server_command, drizzled::Session*, char*, unsigned int)
drizzled::Session::executeStatement()
drizzled::Session::run()
MultiThreadScheduler::runSession(drizzled::Session*)
session_thread()
/lib/libpthread.so.0() [0x87f919]
clone()
Segmentation fault (core dumped)

Changed in drizzle:
status: Incomplete → Confirmed
Changed in drizzle:
importance: Undecided → Medium
assignee: Joe Daly (skinny.moey) → David Shrewsbury (dshrews)
milestone: none → 2010-09-27
Revision history for this message
David Shrewsbury (dshrews) wrote :

Although the subquery used in the example PRINT_TRANSACTION_MESSAGE() call makes no sense, it does crash when the offset being used is not valid:

SELECT PRINT_TRANSACTION_MESSAGE('transaction.log', 10);

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.