summaryrefslogtreecommitdiff
path: root/sql/item_sum.cc
diff options
context:
space:
mode:
authorNisha Gopalakrishnan <nisha.gopalakrishnan@oracle.com>2013-01-15 15:30:26 +0530
committerNisha Gopalakrishnan <nisha.gopalakrishnan@oracle.com>2013-01-15 15:30:26 +0530
commit62e8f2567778e201164ba9e0195f13dfede56b42 (patch)
treec177ff5163e51c6d1c8953eeb892c7cc47ca220a /sql/item_sum.cc
parenta44084413cf48b37a6306e3e6ecf624b8696b330 (diff)
downloadmariadb-git-62e8f2567778e201164ba9e0195f13dfede56b42.tar.gz
Bug#11757464:SERVER CRASH IN RECURSIVE CALL WHEN OOM
Analysis: --------- When the server is out of memory, an error is raised to indicate the same. Handling the error requires more memory to be allocated which fails, hence the error handling loops in a recursion and causes the server to crash. Fix: --- a) Prevents pushing the 'out of memory' error condition to the diagnostic area as it requires memory allocation. GET DIAGNOSTICS, SHOW WARNINGS and SHOW ERRORS statements will not show information about this error. However the 'out of memory' error is returned to the client. b) It sets the ME_FATALERROR flag when 'out of memory' errors are reported (for places where the flag is not already set). This flag prevents activation of SP error handlers which also require memory allocation and therefore are likely to fail.
Diffstat (limited to 'sql/item_sum.cc')
-rw-r--r--sql/item_sum.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index 75aec7918fa..81d151ffba0 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -3211,8 +3211,12 @@ bool Item_func_group_concat::add()
TREE_ELEMENT *el= 0; // Only for safety
if (row_eligible && tree)
{
+ DBUG_EXECUTE_IF("trigger_OOM_in_gconcat_add",
+ DBUG_SET("+d,simulate_persistent_out_of_memory"););
el= tree_insert(tree, table->record[0] + table->s->null_bytes, 0,
tree->custom_arg);
+ DBUG_EXECUTE_IF("trigger_OOM_in_gconcat_add",
+ DBUG_SET("-d,simulate_persistent_out_of_memory"););
/* check if there was enough memory to insert the row */
if (!el)
return 1;