Bug #42946 memory exaustion when performing large multi-statement queries
Submitted: 17 Feb 2009 21:42 Modified: 24 Apr 2009 11:49
Reporter: Antony Curtis Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:5.1.31 OS:Any
Assigned to: CPU Architecture:Any
Tags: crash, DoS

[17 Feb 2009 21:42] Antony Curtis
Description:
When performing large multi-statement queries, the MySQL server may crash.

How to repeat:
See blog post: http://antbits.blogspot.com/2009/02/yet-more-on-stored-procedure.html

Things which make it more likely to occur include use of Stored Procedures.

Executing mysqld in reduced memory limits (for example in gdb) will also make it happen more easily.

Suggested fix:
Looks like the free_root() memory reclamation which currently occurs at the end of the dispatch_command() function in sql_parse.cc probably needs to be called more often when working with large multi-statement queries.
[17 Feb 2009 23:18] MySQL Verification Team
fyi the huge memory usage is reported in bug #27863
[18 Feb 2009 1:56] MySQL Verification Team
Thank you for the bug report. I was able to repeat the crash however this bug could be duplicate of bug http://bugs.mysql.com/bug.php?id=27863 how Shane already commented. Do you agree?. Thanks in advance.
[18 Feb 2009 5:59] Antony Curtis
Yes, looks like similar bug to bug #27863.

Why is this not fixed yet? Original bug was reported in 2007.

I would estimate that bug fix is less than 5 LOC to fix. Impact: minimal.
[18 Feb 2009 7:56] Valeriy Kravchuk
Let's consider this a duplicate of bug #27863 and escalate it.
[24 Apr 2009 5:34] Antony Curtis
still easy to crash server.
[16 Jun 2009 15:11] Guilhem Bichot
Hello all. FYI I'm looking at the master bug of this (BUG#27863) and this is where I'll post progress notes.