mysqld crashes on certain ALTER TABLE queries (MySQL Bug #31145)

Bug #684398 reported by tjw on 2010-12-02
14
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MySQL Server
Unknown
Unknown
mysql-dfsg-5.1 (Ubuntu)
Medium
Unassigned
Karmic
Medium
Unassigned
Lucid
Medium
Unassigned

Bug Description

http://bugs.mysql.com/bug.php?id=31145

This bug causes mysqld from "5.1.41-3ubuntu12.7" to segfault. This is a simple 1 line fix that was added to MySQL 5.1.43. Here is the patch: http://lists.mysql.com/commits/94936.

Could you please backport this fix into the 5.1.41 package on Ubuntu 10.04 LTS?

==== Info for SRU in Karmic, Lucid ====

IMPACT: some ALTER TABLE queries crash the server.

It is fixed in Maverick (mysql-server-5.1 5.1.49-1ubuntu8.1). Tested and confirmed.

TEST CASE:

Install mysql-server-5.1, use the CLI to run the following queries (taken from the upstream bugreport):

CREATE DATABASE grtdiff_alter_test;
CREATE TABLE grtdiff_alter_test.t1 (t TEXT, `id` int(11) DEFAULT NULL, `id2` int(11)
DEFAULT NULL) ENGINE=MyISAM DEFAULT CHARSET=latin1;
ALTER TABLE `grtdiff_alter_test`.`t1` DROP COLUMN `t` , ADD COLUMN `t2` TEXT NULL FIRST;

The last command will return:

ERROR 2013 (HY000): Lost connection to MySQL server during query

And in the /var/log/daemon.log you'll see:

Dec 28 23:52:39 utest-lls32 init: mysql main process (2184) terminated with status 1
Dec 28 23:52:39 utest-lls32 init: mysql main process ended, respawning
Dec 28 23:52:40 utest-lls32 /etc/mysql/debian-start[2413]: Upgrading MySQL tables if necessary.
Dec 28 23:52:40 utest-lls32 /etc/mysql/debian-start[2416]: /usr/bin/mysql_upgrade: the '--basedir' option is always ignored
Dec 28 23:52:40 utest-lls32 /etc/mysql/debian-start[2416]: Looking for 'mysql' as: /usr/bin/mysql
Dec 28 23:52:40 utest-lls32 /etc/mysql/debian-start[2416]: Looking for 'mysqlcheck' as: /usr/bin/mysqlcheck
Dec 28 23:52:40 utest-lls32 /etc/mysql/debian-start[2416]: This installation of MySQL is already upgraded to 5.1.41, use --force if you still need to run mysql_upgrade
Dec 28 23:52:40 utest-lls32 /etc/mysql/debian-start[2423]: Checking for insecure root accounts.
Dec 28 23:52:40 utest-lls32 /etc/mysql/debian-start[2427]: Triggering myisam-recover for all MyISAM tables

a.k.a daemon crashed and was restarted.

After applying the fix the above queries will run without a crash.

REGRESSION POTENTIAL: should be low. The patch was taken directly from upstream (see above commit link).

Clint Byrum (clint-fewbar) wrote :

Hi tjw! Thanks for taking the time to file this report and help us make Ubuntu better.

Looks legitimate and would definitely be a good fix for Lucid.

Nominated for Lucid and marking as Fix Released in the current development release.

Changed in mysql-dfsg-5.1 (Ubuntu):
status: New → Fix Released
importance: Undecided → Medium
Changed in mysql-dfsg-5.1 (Ubuntu Lucid):
status: New → Confirmed
Changed in mysql-dfsg-5.1 (Ubuntu Karmic):
status: New → Confirmed
importance: Undecided → Medium
Changed in mysql-dfsg-5.1 (Ubuntu Lucid):
importance: Undecided → Medium
Changed in mysql-dfsg-5.1 (Ubuntu Lucid):
milestone: none → lucid-updates
Imre Gergely (cemc) wrote :

Attached some debdiffs for Lucid and Karmic, please take a look.
I've tried to build the package with the patch applied, but some tests failed, I'm not sure why. Output before build failing:

The servers were restarted 437 times
Spent 665.008 of 1469 seconds executing testcases

Failed 5/752 tests, 99.34% were successful.

Failing test(s): main.lock_tables_lost_commit main.ctype_ldml main.date_formats main.ctype_latin1_de main.events_restart

I don't think it's related to this patch, maybe there are some special needs for building this, I tried with pbuilder on a Lucid 64bit host.

description: updated
Imre Gergely (cemc) wrote :

I've managed to build the package. Morale of the story: never build two mysql packages at once, because stuff will conflict and tests will fail :-)
After building and testing I realized I forgot to add the patch to 00list, so now I'm redoing it all, and I will attach the new patches in a little while.

Imre Gergely (cemc) wrote :
Imre Gergely (cemc) wrote :
Imre Gergely (cemc) wrote :

The fix is a one-liner, but there were some test added/modified which I did include in the diff, technically it's not part of the fix, but I thought it should be included. As far as I can tell the tests went fine when compiling.

gimre@voy:~/WORK/ubuntu/pbuilder/logs$ cat pbuilder-lucid_i386_build_mysql-dfsg-5.1_5.1.41-3ubuntu12.9.dsc_20101229-104927.log |grep alter_table
62_alter_table_fix not applied to ./ .
dpkg-source: warning: executable mode 0755 of 'debian/patches/62_alter_table_fix.dpatch' will not be represented in diff
applying patch 62_alter_table_fix to ./ ... ok.
ndb.ndb_alter_table [ skipped ] No ndbcluster support
ndb.ndb_alter_table2 [ skipped ] No ndbcluster support
ndb.ndb_alter_table3 [ skipped ] No ndbcluster support
main.alter_table-big [ skipped ] Test needs 'big-test' option
main.alter_table [ pass ] 71
main.csv_alter_table [ pass ] 4
ndb.ndb_alter_table [ skipped ] No ndbcluster support
ndb.ndb_alter_table2 [ skipped ] No ndbcluster support
ndb.ndb_alter_table3 [ skipped ] No ndbcluster support
main.alter_table-big [ skipped ] Test needs 'big-test' option
main.alter_table [ pass ] 117
main.csv_alter_table [ pass ] 4

Martin Pitt (pitti) wrote :

Subscribed sponsors, looks fine for SRU. Thanks!

Accepted mysql-dfsg-5.1 into lucid-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Changed in mysql-dfsg-5.1 (Ubuntu Lucid):
status: Confirmed → Fix Committed
tags: added: verification-needed
Imre Gergely (cemc) wrote :

Confirming fix works on Lucid

mysql> ALTER TABLE `grtdiff_alter_test`.`t1` DROP COLUMN `t` , ADD COLUMN `t2` TEXT NULL FIRST;
Query OK, 0 rows affected (0.13 sec)
Records: 0 Duplicates: 0 Warnings: 0

mysql> \q
Bye
root@utest-lls32:~# apt-cache policy mysql-server
mysql-server:
  Installed: 5.1.41-3ubuntu12.9
  Candidate: 5.1.41-3ubuntu12.9
  Version table:
 *** 5.1.41-3ubuntu12.9 0
        500 http://ro.archive.ubuntu.com/ubuntu/ lucid-proposed/main Packages
        100 /var/lib/dpkg/status
     5.1.41-3ubuntu12.8 0
        500 http://ro.archive.ubuntu.com/ubuntu/ lucid-updates/main Packages
     5.1.41-3ubuntu12.7 0
        500 http://security.ubuntu.com/ubuntu/ lucid-security/main Packages
     5.1.41-3ubuntu12 0
        500 http://ro.archive.ubuntu.com/ubuntu/ lucid/main Packages

root@utest-lls32:~# lsb_release -rd
Description: Ubuntu 10.04.1 LTS
Release: 10.04

tags: added: verification-done
removed: verification-needed
Martin Pitt (pitti) wrote :

At this point I think it is safe to say that it doesn't make much sense to fix that in karmic any more.

Changed in mysql-dfsg-5.1 (Ubuntu Karmic):
status: Confirmed → Won't Fix
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package mysql-dfsg-5.1 - 5.1.41-3ubuntu12.9

---------------
mysql-dfsg-5.1 (5.1.41-3ubuntu12.9) lucid-proposed; urgency=low

  * added patch to fix a bug where certain ALTER TABLE queries would
    crash the server (LP: #684398)
    - debian/patches/62_alter_table_fix.dpatch (mysql bug#31145)
 -- Imre Gergely <email address hidden> Tue, 28 Dec 2010 23:38:54 +0200

Changed in mysql-dfsg-5.1 (Ubuntu Lucid):
status: Fix Committed → Fix Released
tags: added: testcase
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.