You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
main.json_debug_nonembedded_noasan fails because of stack
overrun on Debug + MSAN testing.
Since MDEV-33209 (09ea2dc)
the the stack overflow errors are just injected instead of
frailer mechanisms to consume stack. These mechanims where
not carried forward to the JSON_TABLE functions where
the pattern was the same.
Related MDEV-34099 (cf1c381) makes check_stack_overrun never fail
under Address Sanitizer (only).
The previous ALLOCATE_MEM_ON_STACK did in MemorySanitizer consume
memory, but check_stack_overrun did fail because its 16000 byte
safety margin was exceeded. The allocation of the 448 byte error
ER_STACK_OVERRUN_NEED_MORE is well within these bounds, however
under the safemalloc implementation, "backtrace" library call is called,
which does further allocation for every stack frame. This exceeds the stack.
Fixes:
JSON_TABLE functions that trigger on out of memory debug instrumentation
replaced with the mechanism from MDEV-33209.
The get_disallowed_table_deps_for_list in a non-Debug build returned
incorrectly 1, instead of -1 indicating the out of memory condition.
In json_table add_extra_deps never passed the out of memory error
condition to the caller and would continue to run in a loop, potentially
recursively under these near out of stack conditions.
The Memory, Undefined Behaviour, Address and Thread sanitizers provide
sufficient instrumentation and a backtrace so the safemalloc
functionality provides insufficent value with these. As such is
disabled under WITH_SAFEMALLOC=AUTO.
With all of thse corrected the main.json_debug_nonembedded_noasan no
longer needs its ASAN exclusion.
The JSON_TABLE tests in this test case was dropped in a merge from 10.6
so these tests are re-added.
Copy file name to clipboardExpand all lines: mysql-test/main/json_debug_nonembedded.result
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,8 @@
3
3
#
4
4
SET @saved_dbug = @@debug_dbug;
5
5
SET debug_dbug='+d,json_check_min_stack_requirement';
6
+
SELECT * from JSON_TABLE('[{"a": 1, "b": [11,111]}, {"a": 2, "b": [22,222]}]', '$[*]' COLUMNS( a INT PATH '$.a')) as tt;
7
+
ERROR HY000: Thread stack overrun: 'used bytes' used of a 'available' byte stack, and 'X' bytes needed. Consider increasing the thread_stack system variable.
Copy file name to clipboardExpand all lines: mysql-test/main/json_debug_nonembedded.test
+4-1Lines changed: 4 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,5 @@
1
1
-- source include/not_embedded.inc
2
2
--source include/have_debug.inc
3
-
--source include/not_asan.inc
4
3
5
4
--echo #
6
5
--echo # MDEV-28762: recursive call of some json functions without stack control
@@ -9,6 +8,10 @@
9
8
SET @saved_dbug = @@debug_dbug;
10
9
SET debug_dbug='+d,json_check_min_stack_requirement';
11
10
11
+
--replace_regex /overrun: [0-9]* bytes used of a [0-9]* byte stack, and [0-9]* bytes needed/overrun: 'used bytes' used of a 'available' byte stack, and 'X' bytes needed/
12
+
--error ER_STACK_OVERRUN_NEED_MORE
13
+
SELECT * from JSON_TABLE('[{"a": 1, "b": [11,111]}, {"a": 2, "b": [22,222]}]', '$[*]' COLUMNS( a INT PATH '$.a')) as tt;
0 commit comments