Bug #40949 Debug version of MySQL server crashes when run OPTIMIZE on compressed table.
Submitted: 22 Nov 2008 8:56 Modified: 29 Jan 2009 5:07
Reporter: Sveta Smirnova Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:5.1, 6.0 bzr OS:Any
Assigned to: Sergei Glukhov CPU Architecture:Any

[22 Nov 2008 8:56] Sveta Smirnova
Description:
Debug version of MySQL server crashes when run OPTIMIZE on compressed table:

CURRENT_TEST: main.bug40939
081122 11:26:25 [Note] Plugin 'InnoDB' disabled by command line option
081122 11:26:25 [Note] Falcon: unable to open system data files.
081122 11:26:25 [Note] Falcon: creating new system data files.
081122 11:26:27 [Note] Event Scheduler: Loaded 0 events
081122 11:26:27 [Note] /users/ssmirnova/src/mysql-6.0/sql/mysqld: ready for connections.
Version: '6.0.9-alpha-debug-log'  socket: '/users/ssmirnova/src/mysql-6.0/mysql-test/var/tmp/master.sock'  port: 9306  Source distribution
mysqld: sql_class.cc:460: void Diagnostics_area::set_eof_status(THD*): Assertion `! is_set()' failed.
/users/ssmirnova/src/mysql-6.0/sql/mysqld(my_print_stacktrace+0x26)[0x8934605]
/users/ssmirnova/src/mysql-6.0/sql/mysqld(handle_segfault+0x2f7)[0x82f8afb]
[0x2ce420]
/lib/libc.so.6(abort+0xf8)[0x316678]
/lib/libc.so.6(__assert_fail+0xfd)[0x30e269]
/users/ssmirnova/src/mysql-6.0/sql/mysqld(_ZN16Diagnostics_area14set_eof_statusEP3THD+0x5c)[0x82de5be]
/users/ssmirnova/src/mysql-6.0/sql/mysqld(_Z6my_eofP3THD+0x1e)[0x821fbbe]
/users/ssmirnova/src/mysql-6.0/sql/mysqld[0x84607f4]
/users/ssmirnova/src/mysql-6.0/sql/mysqld(_Z20mysql_optimize_tableP3THDP10TABLE_LISTP15st_ha_check_opt+0xa9)[0x8460cd7]
/users/ssmirnova/src/mysql-6.0/sql/mysqld(_Z21mysql_execute_commandP3THD+0x2e12)[0x83110fc]
/users/ssmirnova/src/mysql-6.0/sql/mysqld(_Z11mysql_parseP3THDPKcjPS2_+0x22b)[0x83177d5]
/users/ssmirnova/src/mysql-6.0/sql/mysqld(_Z16dispatch_command19enum_server_commandP3THDPcj+0x8b3)[0x8318217]
/users/ssmirnova/src/mysql-6.0/sql/mysqld(_Z10do_commandP3THD+0x23a)[0x8319558]
/users/ssmirnova/src/mysql-6.0/sql/mysqld(handle_one_connection+0x11d)[0x83063d1]
/lib/libpthread.so.0[0x45fbd4]
/lib/libc.so.6(__clone+0x5e)[0x3b74fe]
081122 11:26:29 - mysqld got signal 6 ;
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=1048576
read_buffer_size=131072
max_used_connections=1
max_threads=151
thread_count=1
connection_count=1
It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 60054 K
bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

thd: 0xa476098
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...
stack_bottom = 0xae5a1048 thread_stack 0x30c00
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort...
thd->query at 0xa4cbce0 = optimize table t1
thd->thread_id=1
thd->killed=NOT_KILLED
The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.
Writing a core file

Found investigating bug #40939

How to repeat:
create table t1(f1 int, f2 varchar(255));

insert into t1 values(1, 'foo'), (2, 'bar');

insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;

select count(*) from t1;

flush tables;

--exec $MYSQL_TEST_DIR/../storage/myisam/myisampack $MYSQL_TEST_DIR/var/master-data/test/t1

optimize table t1;
[22 Nov 2008 9:02] Sveta Smirnova
Release version is not affected.
[4 Dec 2008 13:38] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/60603

2727 Sergey Glukhov	2008-12-04
      Bug#40949 Debug version of MySQL server crashes when run OPTIMIZE on compressed table.
      reset diagnostics area state after error message is sent
[9 Dec 2008 9:05] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/61010

2733 Sergey Glukhov	2008-12-09
      Bug#40949 Debug version of MySQL server crashes when run OPTIMIZE on compressed table.
      reset diagnostics area state after error message is sent
[15 Jan 2009 6:36] Bugs System
Pushed into 5.1.31 (revid:joro@sun.com-20090115053147-tx1oapthnzgvs1ro) (version source revid:azundris@mysql.com-20081230114838-cn52tu180wcrvh0h) (merge vers: 5.1.31) (pib:6)
[19 Jan 2009 11:22] Bugs System
Pushed into 5.1.31-ndb-6.2.17 (revid:tomas.ulin@sun.com-20090119095303-uwwvxiibtr38djii) (version source revid:tomas.ulin@sun.com-20090115073240-1wanl85vlvw2she1) (merge vers: 5.1.31-ndb-6.2.17) (pib:6)
[19 Jan 2009 13:00] Bugs System
Pushed into 5.1.31-ndb-6.3.21 (revid:tomas.ulin@sun.com-20090119104956-guxz190n2kh31fxl) (version source revid:tomas.ulin@sun.com-20090119104956-guxz190n2kh31fxl) (merge vers: 5.1.31-ndb-6.3.21) (pib:6)
[19 Jan 2009 16:06] Bugs System
Pushed into 5.1.31-ndb-6.4.1 (revid:tomas.ulin@sun.com-20090119144033-4aylstx5czzz88i5) (version source revid:tomas.ulin@sun.com-20090119144033-4aylstx5czzz88i5) (merge vers: 5.1.31-ndb-6.4.1) (pib:6)
[20 Jan 2009 18:53] Bugs System
Pushed into 6.0.10-alpha (revid:joro@sun.com-20090119171328-2hemf2ndc1dxl0et) (version source revid:azundris@mysql.com-20081230114916-c290n83z25wkt6e4) (merge vers: 6.0.9-alpha) (pib:6)
[21 Jan 2009 12:19] Sergey Vojtovich
Sibling BUG#41574.
[29 Jan 2009 5:07] Paul DuBois
Noted in 5.1.31, 6.0.10 changelogs.

For debug servers, OPTIMIZE TABLE on a compressed table caused a
server crash.