Bug #2408 Multiple threads altering MERGE table UNIONs hang/crash
Submitted: 15 Jan 2004 11:45 Modified: 22 Aug 2004 10:23
Reporter: Dean Ellis Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:3.23 OS:
Assigned to: Ingo Strüwing

[15 Jan 2004 11:45] Dean Ellis
Description:
Multiple threads ALTERing the same (or different) MERGE tables to change the UNION eventually crash the server or hang the individual threads.

How to repeat:
perl test case will be attached.  Simply run it twice simultaneously:

./mrgtest.pl a | mysql

and

./mrgtest.pl b | mysql

The crash/hang occurs after just a few seconds.

With 3.23.58, I was only able to reproduce the crash if both threads are ALTERing the same table (change line 25 to refer to MERGE table `a` rather than $basetable).  With 4.0.18 and 4.1.2, it hangs (or sometimes crashes) whether or not they alter the same table.  Initial report (3.23.56 on Solaris) also crashes regardless of whether they alter the same MERGE table.

Problem does not always occur with the same statement or combination of current statements/states, nor does it always produce the same (or even similar) stack trace if it crashes.

skip-external-locking is ON for the Linux tests, although occasionally the processlist shows that one of the hung threads is waiting a system lock.

Suggested fix:
n/a
[21 Aug 2004 1:49] Ingo Strüwing
Refrained from using the global myisam_open_list for scanning for
 MyISAM tables belonging to a MERGE table. While the global list
 is mutex protected, it still contains open tables from all threads.
 MyISAMMRG has now its own list elements for local MERGE table use.
[22 Aug 2004 10:23] Sergei Golubchik
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html

Additional info:

fixed in 3.23.59, 4.0.21, 4.1.1
[22 Oct 2004 12:01] Ingo Strüwing
Shellscript includes the pearl script. You must set DBROOT="install dir".

Attachment: bug2408-2.sh (application/x-sh, text), 4.11 KiB.