Bug #26625 | crash in range optimizer (out of mem) Bug #26624 | ||
---|---|---|---|
Submitted: | 25 Feb 2007 21:49 | Modified: | 31 Mar 2007 23:07 |
Reporter: | Martin Friebe (Gold Quality Contributor) (OCA) | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server | Severity: | S1 (Critical) |
Version: | 5.2.4BK, 5.1.17BK, 5.0.38BK 4.1.23BK | OS: | Any (*) |
Assigned to: | Sergey Petrunya | CPU Architecture: | Any |
Tags: | crash, Memory, Optimizer, qc, range |
[25 Feb 2007 21:49]
Martin Friebe
[25 Feb 2007 21:50]
Martin Friebe
experimental, changing constructors to check for out of mem. (this does not completly fix the issue)
Attachment: sel_arg_nomem.patch (text/x-patch), 4.68 KiB.
[25 Feb 2007 21:59]
MySQL Verification Team
5.0.38BK crash
Attachment: bug26625_stack_5.0.38.txt (text/plain), 5.08 KiB.
[25 Feb 2007 22:06]
MySQL Verification Team
thanks for a bug report, verified as described
[26 Mar 2007 9:00]
Sergey Petrunya
Martin, Thanks for figuring out the problem with constructors. However, if we follow the direction taken in your patch, we will have to make such changes all over the code. Also, it seems that this solution won't work for classes with virtual function.
[26 Mar 2007 9:02]
Sergey Petrunya
Ok, the problems with NULL pointer dereferencing in constructor can be solved by declaring operator new as no-throw (thanks to Dmitry Lenev for pointing this out): ===== sql_list.h 1.32 vs edited ===== --- 1.32/sql/sql_list.h 2007-03-26 12:54:12 +04:00 +++ edited/sql_list.h 2007-03-13 07:32:27 +03:00 @@ -30,7 +30,7 @@ class Sql_alloc { public: - static void *operator new(size_t size) + static void *operator new(size_t size) throw () { return (void*) sql_alloc((uint) size); } @@ -38,7 +38,7 @@ { return (void*) sql_alloc((uint) size); } - static void *operator new(size_t size, MEM_ROOT *mem_root) + static void *operator new(size_t size, MEM_ROOT *mem_root) throw () { return (void*) alloc_root(mem_root, (uint) size); } static void operator delete(void *ptr, size_t size) { TRASH(ptr, size); } static void operator delete(void *ptr, MEM_ROOT *mem_root)
[26 Mar 2007 9:08]
Sergey Petrunya
Besides the above fix, a proper fix for this bug will either 1. Make range optimizer to never require combinatorial amounts of memory, or 2. (if we can't do #1) Limit the amount of memory that can be consumed by the range optimizer.
[28 Mar 2007 14:37]
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/23166 ChangeSet@1.2626, 2007-03-28 18:38:42+04:00, sergefp@mysql.com +1 -0 BUG#26625: crash in range optimizer (out of mem) - Define Sql_alloc::operator new() as thow() so that C++ compiler handles NULL return values (there is no testcase as there is no portable way to set limit on the amount of memory that a process can allocate)
[31 Mar 2007 8:38]
Bugs System
Pushed into 5.1.18-beta
[31 Mar 2007 8:44]
Bugs System
Pushed into 5.0.40
[31 Mar 2007 8:53]
Bugs System
Pushed into 4.1.23
[31 Mar 2007 23:07]
Paul DuBois
Noted in 4.1.23, 5.0.40, 5.1.18 changelogs. The range optimizer could cause the server to run out of memory.