Type:
Bug
Priority:
Major
Resolution:
Duplicate
Affects Version/s:
None
One Libre.Chat, "Albright" got a crash on this query on MariaDB 10.3.31
WITH cte AS (
SELECT
DENSE_RANK() OVER (ORDER BY thread DESC) AS order_rank,
DENSE_RANK() OVER (PARTITION BY thread ORDER BY c.id ASC) AS thread_rank,
c.id,
c.parent,
IF(c.parent = 0, c.id, c.parent) AS thread,
c.user_id,
c.created,
CONVERT_TZ(c.created, @@session.time_zone, "+00:00") AS created_utc,
COALESCE(un.username, un.user_id) AS username,
COALESCE(un.username_slug, un.user_id) AS username_slug,
un.profile_pic,
IF(si.user_id IS NULL, 0, 1) AS is_staff,
IF(sn.sub_id IS NULL, 0, 1) AS is_subscriber,
– SUM() returns NULL instead of zero when there are no values
– (votes) to sum
COALESCE(SUM(cv.value), 0) AS score,
IF(c.parent = 0, COALESCE(SUM(cv.value), 0), -2147483648) AS thread_score,
– We have to put this DENSE_RANK() here. If we put it up top with the
– others, MariaDB 10.3 crashes. Maybe it's because we need to have it
– after the field it uses.
DENSE_RANK() OVER(ORDER BY thread_score DESC, thread DESC) AS score_rank,
COALESCE(c2.count, 0) AS user_comment_count,
COALESCE(c3.count, 0) AS reply_count,
cv2.value AS user_score,
br.html
FROM comment c
INNER JOIN users_new un ON c.user_id = un.user_id
INNER JOIN body_revision br USING (body_revision_id)
LEFT JOIN (
SELECT user_id, count AS count
FROM comment c2
WHERE c2.status = 1
GROUP BY user_id
) AS c2 ON c.user_id = c2.user_id
LEFT JOIN (
SELECT parent, count AS count
FROM comment c3
WHERE c3.status = 1
GROUP BY parent
) AS c3 ON c3.parent = c.id
LEFT JOIN staff_info si ON si.user_id = un.user_id
LEFT JOIN subscriptions_new sn ON c.user_id = sn.user_id AND sn.status = 1
LEFT JOIN comment_vote cv ON c.id = cv.id
LEFT JOIN comment_vote cv2 ON cv2.id = c.id AND cv2.user_id = '108509'
WHERE c.entity_type = 5
AND c.entity_id = '22415'
AND c.status = 1
GROUP BY c.id
ORDER BY created DESC
)
SELECT * FROM cte WHERE (order_rank <= 5 OR score_rank <= 5) AND thread_rank <= 6
Here is the stack trace:
0 libsystem_platform.dylib 0x000000018a4e9c44 _sigtramp + 56
0 mysqld 0x00000001024a2a94 ZL19compare_order_listsP10SQL_I_ListI8st_orderES2 + 260
0 mysqld 0x000000010249f944 _ZN24Window_funcs_computation5setupEP3THDP4ListI16Item_window_funcEP13st_join_table + 316
0 mysqld 0x00000001023a0afc _ZN4JOIN21make_aggr_tables_infoEv + 2948
0 mysqld 0x000000010239a374 _ZN4JOIN15optimize_stage2Ev + 10340
0 mysqld 0x000000010239b50c _ZN4JOIN14optimize_innerEv + 2044
0 mysqld 0x0000000102397acc _ZN4JOIN8optimizeEv + 76
0 mysqld 0x0000000102342b8c _Z22mysql_derived_optimizeP3THDP3LEXP10TABLE_LIST + 264
0 mysqld 0x00000001023437e8 _Z27mysql_handle_single_derivedP3LEXP10TABLE_LISTj + 168
0 mysqld 0x000000010239b4b4 _ZN4JOIN14optimize_innerEv + 1956
0 mysqld 0x0000000102397acc _ZN4JOIN8optimizeEv + 76
0 mysqld 0x00000001023949a4 _Z12mysql_selectP3THDP10TABLE_LISTjR4ListI4ItemEPS4_jP8st_orderS9_S7_S9_yP13select_resultP18st_select_lex_unitP13st_select_lex + 100
0 mysqld 0x00000001023948d4 _Z13handle_selectP3THDP3LEXP13select_resultm + 332
0 mysqld 0x0000000102371fa8 _ZL21execute_sqlcom_selectP3THDP10TABLE_LIST + 952
0 mysqld 0x000000010236c8d4 _Z21mysql_execute_commandP3THD + 1860
0 mysqld 0x000000010236a4e4 _Z11mysql_parseP3THDPcjP12Parser_statebb + 436
0 mysqld 0x00000001023679ac _Z16dispatch_command19enum_server_commandP3THDPcjbb + 2208
0 mysqld 0x00000001023690ec _Z10do_commandP3THD + 292
0 mysqld 0x00000001024332a8 _Z24do_handle_one_connectionP7CONNECT + 444
0 mysqld 0x00000001024330d8 handle_one_connection + 68
0 libsystem_pthread.dylib 0x000000018a49efd4 _pthread_start + 320
0 libsystem_pthread.dylib 0x000000018a499d3c thread_start + 8
relates to
MDEV-19398
Assertion `item1->type() == Item::FIELD_ITEM && item2->type() == Item::FIELD_ITEM' failed in compare_order_elements
Closed
{"report":{"fcp":986.6000000238419,"ttfb":170.5,"pageVisibility":"visible","entityId":102774,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"ea024b12-0d14-4c5d-ab39-ebd52a1c9b2d","navigationType":0,"readyForUser":1048.2000000476837,"redirectCount":0,"resourceLoadedEnd":1189.8999999761581,"resourceLoadedStart":177.70000004768372,"resourceTiming":[{"duration":329.09999990463257,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":177.70000004768372,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":177.70000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":506.7999999523163,"responseStart":0,"secureConnectionStart":0},{"duration":329,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2bu7/820016/12ta74/8679b4946efa1a0bb029a3a22206fb5d/_/download/contextbatch/css/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true","startTime":177.89999997615814,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":177.89999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":506.89999997615814,"responseStart":0,"secureConnectionStart":0},{"duration":338.60000002384186,"initiatorType":"script","name":"https://jira.mariadb.org/s/fbf975c0cce4b1abf04784eeae9ba1f4-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":178,"connectEnd":178,"connectStart":178,"domainLookupEnd":178,"domainLookupStart":178,"fetchStart":178,"redirectEnd":0,"redirectStart":0,"requestStart":178,"responseEnd":516.6000000238419,"responseStart":516.6000000238419,"secureConnectionStart":178},{"duration":364.39999997615814,"initiatorType":"script","name":"https://jira.mariadb.org/s/099b33461394b8015fc36c0a4b96e19f-CDN/lu2bu7/820016/12ta74/8679b4946efa1a0bb029a3a22206fb5d/_/download/contextbatch/js/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true","startTime":178.10000002384186,"connectEnd":178.10000002384186,"connectStart":178.10000002384186,"domainLookupEnd":178.10000002384186,"domainLookupStart":178.10000002384186,"fetchStart":178.10000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":178.10000002384186,"responseEnd":542.5,"responseStart":542.5,"secureConnectionStart":178.10000002384186},{"duration":368.60000002384186,"initiatorType":"script","name":"https://jira.mariadb.org/s/94c15bff32baef80f4096a08aceae8bc-CDN/lu2bu7/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":178.29999995231628,"connectEnd":178.29999995231628,"connectStart":178.29999995231628,"domainLookupEnd":178.29999995231628,"domainLookupStart":178.29999995231628,"fetchStart":178.29999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":178.29999995231628,"responseEnd":546.8999999761581,"responseStart":546.8999999761581,"secureConnectionStart":178.29999995231628},{"duration":370.90000009536743,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":178.29999995231628,"connectEnd":178.29999995231628,"connectStart":178.29999995231628,"domainLookupEnd":178.29999995231628,"domainLookupStart":178.29999995231628,"fetchStart":178.29999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":178.29999995231628,"responseEnd":549.2000000476837,"responseStart":549.2000000476837,"secureConnectionStart":178.29999995231628},{"duration":372.89999997615814,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":178.39999997615814,"connectEnd":178.39999997615814,"connectStart":178.39999997615814,"domainLookupEnd":178.39999997615814,"domainLookupStart":178.39999997615814,"fetchStart":178.39999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":178.39999997615814,"responseEnd":551.2999999523163,"responseStart":551.2999999523163,"secureConnectionStart":178.39999997615814},{"duration":373.39999997615814,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2bu7/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":178.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":178.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":551.8999999761581,"responseStart":0,"secureConnectionStart":0},{"duration":373.2999999523163,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":178.60000002384186,"connectEnd":178.60000002384186,"connectStart":178.60000002384186,"domainLookupEnd":178.60000002384186,"domainLookupStart":178.60000002384186,"fetchStart":178.60000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":178.60000002384186,"responseEnd":551.8999999761581,"responseStart":551.8999999761581,"secureConnectionStart":178.60000002384186},{"duration":374.60000002384186,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2bu7/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/css/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.css?jira.create.linked.issue=true","startTime":178.79999995231628,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":178.79999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":553.3999999761581,"responseStart":0,"secureConnectionStart":0},{"duration":374.60000002384186,"initiatorType":"script","name":"https://jira.mariadb.org/s/3339d87fa2538a859872f2df449bf8d0-CDN/lu2bu7/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/js/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.js?jira.create.linked.issue=true&locale=en","startTime":178.89999997615814,"connectEnd":178.89999997615814,"connectStart":178.89999997615814,"domainLookupEnd":178.89999997615814,"domainLookupStart":178.89999997615814,"fetchStart":178.89999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":178.89999997615814,"responseEnd":553.5,"responseStart":553.5,"secureConnectionStart":178.89999997615814},{"duration":506.6999999284744,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":179.70000004768372,"connectEnd":179.70000004768372,"connectStart":179.70000004768372,"domainLookupEnd":179.70000004768372,"domainLookupStart":179.70000004768372,"fetchStart":179.70000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":179.70000004768372,"responseEnd":686.3999999761581,"responseStart":686.3999999761581,"secureConnectionStart":179.70000004768372},{"duration":1010.1999999284744,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":179.70000004768372,"connectEnd":179.70000004768372,"connectStart":179.70000004768372,"domainLookupEnd":179.70000004768372,"domainLookupStart":179.70000004768372,"fetchStart":179.70000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":179.70000004768372,"responseEnd":1189.8999999761581,"responseStart":1189.8999999761581,"secureConnectionStart":179.70000004768372},{"duration":303.60000002384186,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":733.6000000238419,"connectEnd":733.6000000238419,"connectStart":733.6000000238419,"domainLookupEnd":733.6000000238419,"domainLookupStart":733.6000000238419,"fetchStart":733.6000000238419,"redirectEnd":0,"redirectStart":0,"requestStart":733.6000000238419,"responseEnd":1037.2000000476837,"responseStart":1037.2000000476837,"secureConnectionStart":733.6000000238419}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":3,"responseStart":171,"responseEnd":173,"domLoading":176,"domInteractive":1213,"domContentLoadedEventStart":1213,"domContentLoadedEventEnd":1248,"domComplete":2157,"loadEventStart":2157,"loadEventEnd":2159,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1197.1000000238419},{"name":"bigPipe.sidebar-id.end","time":1197.8999999761581},{"name":"bigPipe.activity-panel-pipe-id.start","time":1198.1000000238419},{"name":"bigPipe.activity-panel-pipe-id.end","time":1200.5},{"name":"activityTabFullyLoaded","time":1254.5}],"measures":[],"correlationId":"ea2eba1fa57c55","effectiveType":"4g","downlink":9.1,"rtt":0,"serverDuration":108,"dbReadsTimeInMs":9,"dbConnsTimeInMs":17,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}