Bug #25963 select into temp table from view inside transaction crashes server
Submitted: 31 Jan 2007 5:09 Modified: 31 Jan 2007 9:30
Reporter: Travers Carter Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: General Severity:S2 (Serious)
Version:5.0.27 OS:Linux (Linux x86_64)
Assigned to: Sveta Smirnova CPU Architecture:Any
Tags: crash

[31 Jan 2007 5:09] Travers Carter
Description:
When inserting into a temporary table from a view involving more than one table inside a transaction the MySQL server crashes, if the insert is not inside a transaction or the table is not temporary the server does not crash.

If the last line of the test case is changed to use 't.id' instead of '*':
INSERT INTO tmp_test (id) SELECT t.id FROM test_view t;

The the crash is not visible until some other statement is executed, eg SHOW WARNINGS
...
mysql> SHOW WARNINGS;
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id:    3
Current database: test

From the log file:
mysqld 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.

key_buffer_size=67108864
read_buffer_size=16773120
max_used_connections=1
max_connections=128
threads_connected=1
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_connections = 4259327 K
bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

thd=0x1408e60
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
Cannot determine thread, fp=0x450c9ff8, backtrace may not be correct.
Stack range sanity check OK, backtrace follows:
0x746f6f72
New value of fp=0x1408e60 failed sanity check, terminating stack trace!
Please read http://dev.mysql.com/doc/mysql/en/Using_stack_trace.html and follow instructions on how to resolve the stack trace. Resolved
stack trace is much more helpful in diagnosing the problem, so please do
resolve it
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort...
thd->query at 0x1416570 = INSERT INTO tmp_test (id) SELECT id FROM test_view t
thd->thread_id=3
The manual page at http://www.mysql.com/doc/en/Crashing.html contains
information that should help you find out what is causing the crash.

Number of processes running now: 0

How to repeat:
mysql> use test;
mysql> DROP TABLE IF EXISTS test1;
Query OK, 0 rows affected (0.00 sec)

mysql> CREATE TABLE test1 (id INT(10) UNSIGNED NOT NULL, PRIMARY KEY (id));
Query OK, 0 rows affected (0.02 sec)

mysql> DROP VIEW IF EXISTS test_view;
Query OK, 0 rows affected (0.00 sec)

mysql> CREATE SQL SECURITY INVOKER
    -> VIEW test_view AS
    -> SELECT t1.id AS id, t2.id AS OtherID
    ->   FROM test1 t1 JOIN test1 t2;
Query OK, 0 rows affected (0.00 sec)

mysql> START TRANSACTION;
Query OK, 0 rows affected (0.00 sec)

mysql> DROP TEMPORARY TABLE IF EXISTS tmp_test;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> CREATE TEMPORARY TABLE tmp_test (id int unsigned NOT NULL);
Query OK, 0 rows affected (0.00 sec)

mysql> INSERT INTO tmp_test (id) SELECT * FROM test_view t;
ERROR 2013 (HY000): Lost connection to MySQL server during query
[31 Jan 2007 8:54] Sveta Smirnova
Thank you for the report.

I can not repeat it using current BK sources. Please upgrade to version 5.0.33 and if you can repeat crash, send content of your my.cnf file.
[31 Jan 2007 9:30] Travers Carter
After upgrading to 5.0.33 I can no longer reproduce the problem.