mirror of
				https://github.com/MariaDB/server.git
				synced 2025-11-03 20:36:16 +01:00 
			
		
		
		
	main.json_debug_nonembedded_noasan fails because of stack overrun on Debug + MSAN testing. Since MDEV-33209 (09ea2dc788) 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 (cf1c381bb8) 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.
		
			
				
	
	
		
			15 lines
		
	
	
	
		
			757 B
		
	
	
	
		
			Text
		
	
	
	
	
	
			
		
		
	
	
			15 lines
		
	
	
	
		
			757 B
		
	
	
	
		
			Text
		
	
	
	
	
	
#
 | 
						|
# MDEV-28762: recursive call of some json functions without stack control
 | 
						|
#
 | 
						|
SET @saved_dbug = @@debug_dbug;
 | 
						|
SET debug_dbug='+d,json_check_min_stack_requirement';
 | 
						|
SELECT * from JSON_TABLE('[{"a": 1, "b": [11,111]}, {"a": 2, "b": [22,222]}]', '$[*]' COLUMNS( a INT PATH '$.a')) as tt;
 | 
						|
ERROR HY000: Thread stack overrun:  'used bytes' used of a 'available' byte stack, and 'X' bytes needed. Consider increasing the thread_stack system variable.
 | 
						|
SET @json1= '{"key1":"val1"}';
 | 
						|
SET @json2= '{"key1":"val1"}';
 | 
						|
SELECT JSON_OVERLAPS(@json1, @json2);
 | 
						|
ERROR HY000: Thread stack overrun:  'used bytes' used of a 'available' byte stack, and 'X' bytes needed. Consider increasing the thread_stack system variable.
 | 
						|
SET @@debug_dbug= @saved_dbug;
 | 
						|
#
 | 
						|
# End of 10.9 test
 | 
						|
#
 |