[MDEV-23428] Server crashed on JSON_ARRAYAGG(DISTINCT ...) [strcoll.ic:255] Created: 2020-08-07  Updated: 2020-11-15  Resolved: 2020-11-15

Status: Closed
Project: MariaDB Server
Component/s: JSON
Affects Version/s: 10.5.4
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Sebastian Stamm Assignee: Unassigned
Resolution: Incomplete Votes: 0
Labels: need_feedback
Environment:

Windows Server 2012R2



 Description   

I guess the mixture of DISTINCT and GROUP BY is not good, but should not crash the whole server.

200807 14:36:00 [ERROR] mysqld got exception 0xc0000005 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
 
To report this bug, see https://mariadb.com/kb/en/reporting-bugs
 
We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed, 
something is definitely wrong and this may fail.
 
Server version: 10.5.4-MariaDB
key_buffer_size=134217728
read_buffer_size=67108864
max_used_connections=1
max_threads=65537
thread_count=2
It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 266322 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.
 
Thread pointer: 0xfe9e0a58f8
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
server.dll!my_strnncollsp_utf8mb4_bin()[strcoll.ic:255]
server.dll!Field_blob::cmp_max()[field.cc:8512]
server.dll!group_concat_key_cmp_with_distinct_with_nulls()[item_sum.cc:3608]
server.dll!tree_insert()[tree.c:248]
server.dll!Item_func_group_concat::add()[item_sum.cc:4173]
server.dll!update_sum_func()[sql_select.cc:25642]
server.dll!end_send_group()[sql_select.cc:22009]
server.dll!evaluate_join_record()[sql_select.cc:20824]
server.dll!AGGR_OP::end_send()[sql_select.cc:28871]
server.dll!sub_select_postjoin_aggr()[sql_select.cc:20311]
server.dll!do_select()[sql_select.cc:20136]
server.dll!JOIN::exec_inner()[sql_select.cc:4444]
server.dll!JOIN::exec()[sql_select.cc:4226]
server.dll!mysql_select()[sql_select.cc:4651]
server.dll!handle_select()[sql_select.cc:417]
server.dll!execute_sqlcom_select()[sql_parse.cc:6209]
server.dll!mysql_execute_command()[sql_parse.cc:3939]
server.dll!mysql_parse()[sql_parse.cc:7997]
server.dll!dispatch_command()[sql_parse.cc:1877]
server.dll!do_command()[sql_parse.cc:1355]
server.dll!threadpool_process_request()[threadpool_common.cc:354]
server.dll!tp_callback()[threadpool_common.cc:194]
ntdll.dll!RtlFreeUnicodeString()
ntdll.dll!RtlFreeUnicodeString()
KERNEL32.DLL!BaseThreadInitThunk()
ntdll.dll!RtlUserThreadStart()
 
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0xfe9e0852e0): SELECT 
 
COUNT(DISTINCT flightRecordId),
 
 
 
JSON_ARRAYAGG(DISTINCT JSON_OBJECT('ocDeviceId', ocDeviceId, 'keys', JSON_EXTRACT(versionData,'$')))
 
 
 
 
 
FROM device JOIN flightrecord USING(deviceId)
 
 
 
JOIN othercomponent USING(flightRecordId)
 
 
 
JOIN ocversion USING(ocId)
 
 
 
WHERE calendarWeek > 202025 AND country LIKE 'DE%'
 
 
 
GROUP BY ocDeviceId
 
#GROUP BY JSON_KEYS(versionData)
Connection ID (thread ID): 4
Status: NOT_KILLED
 
Optimizer switch: index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=on,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on,condition_pushdown_from_having=on,not_null_range_scan=off
 
The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.
Writing a core file at D:\MariaDB 10.5\data\



 Comments   
Comment by Elena Stepanova [ 2020-10-17 ]

Could you please paste the output of

SHOW CREATE TABLE ...;
SHOW INDEX IN ...;

For each of 4 involved tables?

A data dump would be even better of course.

Generated at Thu Feb 08 09:22:19 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.