The test case is for reproducing/debugging only, don't put it into the regression suite!
Create a deterministic synchronized one instead.
The test case is obviously non-deterministic. If it doesn't fail for you right away, try to adjust run and show values.
--connect (con1,localhost,root,,test)
--let $conid= `SELECT CONNECTION_ID()`
--let $run=100
while ($run)
{
send
SELECT * FROM sys.waits_by_user_by_latency;
--connection default
--let $show=100
while ($show)
{
--error 0,ER_TARGET_NOT_EXPLAINABLE
eval SHOW EXPLAIN FORMAT=JSON FOR $conid;
--dec $show
}
--connection con1
--reap
--dec $run
}
# Cleanup
--disconnect con1
preview-10.9-MDEV-27021-explain cc5d67c02
#3 <signal handler called>
#4 0x000055882b57378b in append_item_to_str (out=0x7ffa57f67c90, item=0x7ffa4c01df28) at /data/src/preview-10.9-explain-gcov/sql/sql_explain.cc:1546
#5 0x000055882b56fa70 in Explain_aggr_filesort::print_json_members (this=0x7ffa4c070680, writer=0x7ffa57f68050, is_analyze=false) at /data/src/preview-10.9-explain-gcov/sql/sql_explain.cc:1059
#6 0x000055882b574c03 in Explain_table_access::print_explain_json (this=0x7ffa4c070120, query=0x7ffa4c06da88, writer=0x7ffa57f68050, is_analyze=false) at /data/src/preview-10.9-explain-gcov/sql/sql_explain.cc:1736
#7 0x000055882b5701e3 in Explain_basic_join::print_explain_json_interns (this=0x7ffa4c06ffe8, query=0x7ffa4c06da88, writer=0x7ffa57f68050, is_analyze=false) at /data/src/preview-10.9-explain-gcov/sql/sql_explain.cc:1115
#8 0x000055882b56f4f2 in Explain_select::print_explain_json (this=0x7ffa4c06ffe8, query=0x7ffa4c06da88, writer=0x7ffa57f68050, is_analyze=false) at /data/src/preview-10.9-explain-gcov/sql/sql_explain.cc:1010
#9 0x000055882b56926c in Explain_query::print_explain_json (this=0x7ffa4c06da88, output=0x7ffa48018448, is_analyze=false, query_time_in_progress_ms=57) at /data/src/preview-10.9-explain-gcov/sql/sql_explain.cc:238
#10 0x000055882b132e3c in LEX::print_explain (this=0x7ffa4c005100, output=0x7ffa48018448, explain_flags=0 '\000', is_analyze=false, is_json_format=true, printed_anything=0x7ffa57f6822f) at /data/src/preview-10.9-explain-gcov/sql/sql_lex.cc:5856
#11 0x000055882b30fdc0 in Show_explain_request::call_in_target_thread (this=0x7ffa57fb2250) at /data/src/preview-10.9-explain-gcov/sql/sql_show.cc:3003
#12 0x000055882b5db21e in Apc_target::process_apc_requests (this=0x7ffa4c0050a8) at /data/src/preview-10.9-explain-gcov/sql/my_apc.cc:222
#13 0x000055882b57da5f in Apc_target::disable (this=0x7ffa4c0050a8) at /data/src/preview-10.9-explain-gcov/sql/my_apc.h:73
#14 0x000055882b5681c5 in Explain_query::~Explain_query (this=0x7ffa4c06da88, __in_chrg=<optimized out>) at /data/src/preview-10.9-explain-gcov/sql/sql_explain.cc:68
#15 0x000055882b57be06 in delete_explain_query (lex=0x7ffa4c005100) at /data/src/preview-10.9-explain-gcov/sql/sql_explain.cc:2584
#16 0x000055882b18ac30 in log_slow_statement (thd=0x7ffa4c000db8) at /data/src/preview-10.9-explain-gcov/sql/sql_parse.cc:2561
#17 0x000055882b189f11 in dispatch_command (command=COM_QUERY, thd=0x7ffa4c000db8, packet=0x7ffa4c00b9a9 "", packet_length=42, blocking=true) at /data/src/preview-10.9-explain-gcov/sql/sql_parse.cc:2427
#18 0x000055882b18350d in do_command (thd=0x7ffa4c000db8, blocking=true) at /data/src/preview-10.9-explain-gcov/sql/sql_parse.cc:1403
#19 0x000055882b4e55db in do_handle_one_connection (connect=0x558830facaf8, put_in_cache=true) at /data/src/preview-10.9-explain-gcov/sql/sql_connect.cc:1418
#20 0x000055882b4e4de2 in handle_one_connection (arg=0x558830facaf8) at /data/src/preview-10.9-explain-gcov/sql/sql_connect.cc:1312
#21 0x000055882bde30cb in pfs_spawn_thread (arg=0x558830facbd8) at /data/src/preview-10.9-explain-gcov/storage/perfschema/pfs.cc:2201
#22 0x00007ffa69b04ea7 in start_thread (arg=<optimized out>) at pthread_create.c:477
#23 0x00007ffa69703def in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
Also reproducible with SHOW ANALYZE FORMAT=JSON
Attachments
Issue Links
is caused by
MDEV-27021Extend SHOW EXPLAIN to support SHOW ANALYZE [FORMAT=JSON]
I've encountered something similar to this for ANALYZE. Check out comments for the Item_temptable_field.
Note there:
Step #4 is done after step #3, so "ANALYZE stmt" has no problem printing
Item_field objects that refer to regular tables.
is this true anymore?
Sergei Petrunia
added a comment - https://gist.github.com/spetrunia/3e2fa7081caf2a13f843e9fa5f93103b - If I apply this, I start getting a different kind of crash: https://gist.github.com/spetrunia/d3342301e28b89096e12e853d024de8c .
I've encountered something similar to this for ANALYZE. Check out comments for the Item_temptable_field.
Note there:
Step #4 is done after step #3, so "ANALYZE stmt" has no problem printing
Item_field objects that refer to regular tables.
is this true anymore?
#4 0x0000555556b3bbc6 in root_free (root=0x7ffff010dd20, ptr=0x7fff7c0082d8, size=1016) at /home/psergey/dev-git2/10.9-review-analyze-oleg/mysys/my_alloc.c:78
#5 0x0000555556b3c997 in free_root (root=0x7ffff010dd20, MyFlags=0) at /home/psergey/dev-git2/10.9-review-analyze-oleg/mysys/my_alloc.c:495
#6 0x0000555555fa5562 in free_tmp_table (thd=0x7fff7c000d78, entry=0x7fff7ce0e0b0) at /home/psergey/dev-git2/10.9-review-analyze-oleg/sql/sql_select.cc:20406
#7 0x0000555555e53640 in close_thread_tables (thd=0x7fff7c000d78) at /home/psergey/dev-git2/10.9-review-analyze-oleg/sql/sql_base.cc:840
#8 0x0000555555f11165 in mysql_execute_command (thd=0x7fff7c000d78, is_called_from_prepared_stmt=false) at /home/psergey/dev-git2/10.9-review-analyze-oleg/sql/sql_parse.cc:6056
#9 0x0000555555f16bdd in mysql_parse (thd=0x7fff7c000d78, rawbuf=0x7fff7c014220 "SELECT column_name FROM information_schema.columns WHERE table_schema IN ('mysql','information_schema','performance_schema','sys')", length=132, parser_state=0x7ffff010e500) at /home/psergey/dev-git2/10.9-review-analyze-oleg/sql/sql_parse.cc:8029
#10 0x0000555555f03067 in dispatch_command (command=COM_QUERY, thd=0x7fff7c000d78, packet=0x7fff7c00ba89 "", packet_length=132, blocking=true) at /home/psergey/dev-git2/10.9-review-analyze-oleg/sql/sql_parse.cc:1895
#11 0x0000555555f01934 in do_command (thd=0x7fff7c000d78, blocking=true) at /home/psergey/dev-git2/10.9-review-analyze-oleg/sql/sql_parse.cc:1403
#12 0x00005555560d59a6 in do_handle_one_connection (connect=0x555558c75748, put_in_cache=true) at /home/psergey/dev-git2/10.9-review-analyze-oleg/sql/sql_connect.cc:1418
#13 0x00005555560d563c in handle_one_connection (arg=0x555558c75748) at /home/psergey/dev-git2/10.9-review-analyze-oleg/sql/sql_connect.cc:1312
#14 0x00005555565ce79f in pfs_spawn_thread (arg=0x555558b6d778) at /home/psergey/dev-git2/10.9-review-analyze-oleg/storage/perfschema/pfs.cc:2201
Note that the table is freed in free_tmp_table(), that is, it's a temporary table.
However, the Item_field object pointing to it is NOT an Item_temptable_field..
(gdb) p $i
$113 = (Item_func_in * const) 0x7fff74017b58
(gdb) p $i->args[0]
$114 = (Item_field *) 0x7fff74017748
Sergei Petrunia
added a comment - - edited This is where the Field object gets freed:
#4 0x0000555556b3bbc6 in root_free (root=0x7ffff010dd20, ptr=0x7fff7c0082d8, size=1016) at /home/psergey/dev-git2/10.9-review-analyze-oleg/mysys/my_alloc.c:78
#5 0x0000555556b3c997 in free_root (root=0x7ffff010dd20, MyFlags=0) at /home/psergey/dev-git2/10.9-review-analyze-oleg/mysys/my_alloc.c:495
#6 0x0000555555fa5562 in free_tmp_table (thd=0x7fff7c000d78, entry=0x7fff7ce0e0b0) at /home/psergey/dev-git2/10.9-review-analyze-oleg/sql/sql_select.cc:20406
#7 0x0000555555e53640 in close_thread_tables (thd=0x7fff7c000d78) at /home/psergey/dev-git2/10.9-review-analyze-oleg/sql/sql_base.cc:840
#8 0x0000555555f11165 in mysql_execute_command (thd=0x7fff7c000d78, is_called_from_prepared_stmt=false) at /home/psergey/dev-git2/10.9-review-analyze-oleg/sql/sql_parse.cc:6056
#9 0x0000555555f16bdd in mysql_parse (thd=0x7fff7c000d78, rawbuf=0x7fff7c014220 "SELECT column_name FROM information_schema.columns WHERE table_schema IN ('mysql','information_schema','performance_schema','sys')", length=132, parser_state=0x7ffff010e500) at /home/psergey/dev-git2/10.9-review-analyze-oleg/sql/sql_parse.cc:8029
#10 0x0000555555f03067 in dispatch_command (command=COM_QUERY, thd=0x7fff7c000d78, packet=0x7fff7c00ba89 "", packet_length=132, blocking=true) at /home/psergey/dev-git2/10.9-review-analyze-oleg/sql/sql_parse.cc:1895
#11 0x0000555555f01934 in do_command (thd=0x7fff7c000d78, blocking=true) at /home/psergey/dev-git2/10.9-review-analyze-oleg/sql/sql_parse.cc:1403
#12 0x00005555560d59a6 in do_handle_one_connection (connect=0x555558c75748, put_in_cache=true) at /home/psergey/dev-git2/10.9-review-analyze-oleg/sql/sql_connect.cc:1418
#13 0x00005555560d563c in handle_one_connection (arg=0x555558c75748) at /home/psergey/dev-git2/10.9-review-analyze-oleg/sql/sql_connect.cc:1312
#14 0x00005555565ce79f in pfs_spawn_thread (arg=0x555558b6d778) at /home/psergey/dev-git2/10.9-review-analyze-oleg/storage/perfschema/pfs.cc:2201
Note that the table is freed in free_tmp_table(), that is, it's a temporary table.
However, the Item_field object pointing to it is NOT an Item_temptable_field..
(gdb) p $i
$113 = (Item_func_in * const) 0x7fff74017b58
(gdb) p $i->args[0]
$114 = (Item_field *) 0x7fff74017748
Sergei Petrunia
added a comment - - edited Fix candidate : https://gist.github.com/spetrunia/211ae821160d5ecdbb403609d536f538 . It also fixes MDEV-28125 .
Because the sys schema depends on PLUGIN_PERFSCHEMA,
--source include/have_perfschema.inc
should have been included in the tests.
Marko Mäkelä
added a comment - Because the sys schema depends on PLUGIN_PERFSCHEMA ,
--source include/have_perfschema.inc
should have been included in the tests.
People
Sergei Petrunia
Elena Stepanova
Votes:
0Vote for this issue
Watchers:
4Start watching this issue
Dates
Created:
Updated:
Resolved:
Git Integration
Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.
{"report":{"fcp":862.8000001907349,"ttfb":239.5,"pageVisibility":"visible","entityId":108949,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":1,"journeyId":"a78a0bce-ee5e-475a-b759-8cb825e93f42","navigationType":0,"readyForUser":986.5999999046326,"redirectCount":0,"resourceLoadedEnd":597.7000002861023,"resourceLoadedStart":247.40000009536743,"resourceTiming":[{"duration":76.30000019073486,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":247.40000009536743,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":247.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":323.7000002861023,"responseStart":0,"secureConnectionStart":0},{"duration":77.7999997138977,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/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&whisper-enabled=true","startTime":247.7000002861023,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":247.7000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":325.5,"responseStart":0,"secureConnectionStart":0},{"duration":216.19999980926514,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":247.80000019073486,"connectEnd":247.80000019073486,"connectStart":247.80000019073486,"domainLookupEnd":247.80000019073486,"domainLookupStart":247.80000019073486,"fetchStart":247.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":327.30000019073486,"responseEnd":464,"responseStart":339.09999990463257,"secureConnectionStart":247.80000019073486},{"duration":331.2000002861023,"initiatorType":"script","name":"https://jira.mariadb.org/s/2d8175ec2fa4c816e8023260bd8c1786-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/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&whisper-enabled=true","startTime":248.09999990463257,"connectEnd":248.09999990463257,"connectStart":248.09999990463257,"domainLookupEnd":248.09999990463257,"domainLookupStart":248.09999990463257,"fetchStart":248.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":330.09999990463257,"responseEnd":579.3000001907349,"responseStart":344.5,"secureConnectionStart":248.09999990463257},{"duration":98.90000009536743,"initiatorType":"script","name":"https://jira.mariadb.org/s/a9324d6758d385eb45c462685ad88f1d-CDN/lu2cib/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":248.30000019073486,"connectEnd":248.30000019073486,"connectStart":248.30000019073486,"domainLookupEnd":248.30000019073486,"domainLookupStart":248.30000019073486,"fetchStart":248.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":331,"responseEnd":347.2000002861023,"responseStart":346.09999990463257,"secureConnectionStart":248.30000019073486},{"duration":100.80000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":248.5,"connectEnd":248.5,"connectStart":248.5,"domainLookupEnd":248.5,"domainLookupStart":248.5,"fetchStart":248.5,"redirectEnd":0,"redirectStart":0,"requestStart":331.09999990463257,"responseEnd":349.30000019073486,"responseStart":347.5,"secureConnectionStart":248.5},{"duration":101,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":248.7000002861023,"connectEnd":248.7000002861023,"connectStart":248.7000002861023,"domainLookupEnd":248.7000002861023,"domainLookupStart":248.7000002861023,"fetchStart":248.7000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":332.5,"responseEnd":349.7000002861023,"responseStart":347.90000009536743,"secureConnectionStart":248.7000002861023},{"duration":81.59999990463257,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2cib/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":248.90000009536743,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":248.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":330.5,"responseStart":0,"secureConnectionStart":0},{"duration":103.30000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":249.09999990463257,"connectEnd":249.09999990463257,"connectStart":249.09999990463257,"domainLookupEnd":249.09999990463257,"domainLookupStart":249.09999990463257,"fetchStart":249.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":333.90000009536743,"responseEnd":352.40000009536743,"responseStart":350.7000002861023,"secureConnectionStart":249.09999990463257},{"duration":82.69999980926514,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2cib/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":249.30000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":249.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":332,"responseStart":0,"secureConnectionStart":0},{"duration":116.40000009536743,"initiatorType":"script","name":"https://jira.mariadb.org/s/5d5e8fe91fbc506585e83ea3b62ccc4b-CDN/lu2cib/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":249.40000009536743,"connectEnd":249.40000009536743,"connectStart":249.40000009536743,"domainLookupEnd":249.40000009536743,"domainLookupStart":249.40000009536743,"fetchStart":249.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":335.5,"responseEnd":365.80000019073486,"responseStart":363.7000002861023,"secureConnectionStart":249.40000009536743},{"duration":343.19999980926514,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":252.7000002861023,"connectEnd":252.7000002861023,"connectStart":252.7000002861023,"domainLookupEnd":252.7000002861023,"domainLookupStart":252.7000002861023,"fetchStart":252.7000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":447.80000019073486,"responseEnd":595.9000000953674,"responseStart":586.5999999046326,"secureConnectionStart":252.7000002861023},{"duration":344.90000009536743,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":252.80000019073486,"connectEnd":252.80000019073486,"connectStart":252.80000019073486,"domainLookupEnd":252.80000019073486,"domainLookupStart":252.80000019073486,"fetchStart":252.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":517.5,"responseEnd":597.7000002861023,"responseStart":590.0999999046326,"secureConnectionStart":252.80000019073486},{"duration":71.09999990463257,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":613.4000000953674,"connectEnd":613.4000000953674,"connectStart":613.4000000953674,"domainLookupEnd":613.4000000953674,"domainLookupStart":613.4000000953674,"fetchStart":613.4000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":652.3000001907349,"responseEnd":684.5,"responseStart":683.7000002861023,"secureConnectionStart":613.4000000953674}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":39,"responseStart":239,"responseEnd":249,"domLoading":243,"domInteractive":1059,"domContentLoadedEventStart":1059,"domContentLoadedEventEnd":1115,"domComplete":1533,"loadEventStart":1533,"loadEventEnd":1534,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1030.7000002861023},{"name":"bigPipe.sidebar-id.end","time":1031.5},{"name":"bigPipe.activity-panel-pipe-id.start","time":1031.5999999046326},{"name":"bigPipe.activity-panel-pipe-id.end","time":1033.9000000953674},{"name":"activityTabFullyLoaded","time":1133.7000002861023}],"measures":[],"correlationId":"21b5364acbd906","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":133,"dbReadsTimeInMs":15,"dbConnsTimeInMs":32,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
https://gist.github.com/spetrunia/3e2fa7081caf2a13f843e9fa5f93103b - If I apply this, I start getting a different kind of crash: https://gist.github.com/spetrunia/d3342301e28b89096e12e853d024de8c .
I've encountered something similar to this for ANALYZE. Check out comments for the Item_temptable_field.
Note there:
is this true anymore?