Kernel version: Linux version 3.10.0-1160.99.1.el7.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 4.8.520150623 (Red Hat 4.8.5-44) (GCC) ) #1 SMP Wed Sep 1314:19:20 UTC 2023
Attachments
Issue Links
duplicates
MDEV-26115Crash when calling stored function in FOR loop argument
The stack trace contains _ZN7Item_sp7cleanupEv+0x1f, which is near the start of the following function:
void
Item_sp::cleanup()
{
delete sp_result_field;
sp_result_field= NULL;
m_sp= NULL;
delete func_ctx;
func_ctx= NULL;
free_root(&sp_mem_root, MYF(0));
dummy_table->alias.free();
}
Without seeing the compiled code, I can only guess, but I think that it is plausible that this crashes in one of the delete statements when invoking an inlined destructor. Could it be that this=nullptr here? A full stack trace of the crash would help a lot. I’m not deeply familiar with Docker or the pre-made MariaDB containers. You may need https://quay.io/repository/mariadb-foundation/mariadb-debug which should allow you to obtain a resolved stack trace from GDB.
Marko Mäkelä
added a comment - The stack trace contains _ZN7Item_sp7cleanupEv+0x1f , which is near the start of the following function:
void
Item_sp::cleanup()
{
delete sp_result_field;
sp_result_field= NULL ;
m_sp= NULL ;
delete func_ctx;
func_ctx= NULL ;
free_root(&sp_mem_root, MYF(0));
dummy_table->alias. free ();
}
Without seeing the compiled code, I can only guess, but I think that it is plausible that this crashes in one of the delete statements when invoking an inlined destructor. Could it be that this=nullptr here? A full stack trace of the crash would help a lot. I’m not deeply familiar with Docker or the pre-made MariaDB containers. You may need https://quay.io/repository/mariadb-foundation/mariadb-debug which should allow you to obtain a resolved stack trace from GDB.
hi, Alice,
plz note that, when I send "call p1()" in 10.6.16, DB runs normal,
but, when I send "set global general_log=1" first, then "call p1", db got crash,
that's not exactly the same。
Shawn Yan
added a comment - hi, Alice,
plz note that, when I send "call p1()" in 10.6.16, DB runs normal,
but, when I send "set global general_log=1" first, then "call p1", db got crash,
that's not exactly the same。
shawn2016 It is also repeatable without setting general_log=1, just after the second execution of the procedure. But sure after MDEV-26115 will be patched - this test should be checked again.
MariaDB [test]> select version();
+-----------------+
| version() |
+-----------------+
| 10.6.16-MariaDB |
+-----------------+
1 row in set (0,000 sec)
MariaDB [test]> delimiter |
MariaDB [test]> CREATE OR REPLACE FUNCTION cnt()
-> RETURNS INTEGER
-> NO SQL
-> BEGIN
-> RETURN 1;
-> END;|
Query OK, 0 rows affected (0,014 sec)
MariaDB [test]> CREATE OR REPLACE PROCEDURE p1()
-> NO SQL
-> BEGIN
-> DECLARE i INTEGER;
-> FOR i IN 1..cnt() DO
-> SELECT i;
-> END FOR;
-> END;|
Query OK, 0 rows affected (0,020 sec)
MariaDB [test]> CALL p1()|
+---+
| i |
+---+
| 1 |
+---+
1 row in set (0,001 sec)
Query OK, 0 rows affected (0,001 sec)
MariaDB [test]> CALL p1()|
ERROR 2013 (HY000): Lost connection to server during query
231121 12:26:33 [ERROR] mysqld got signal 11 ;
Server version: 10.6.16-MariaDB source revision: b83c379420a8846ae4b28768d3c81fa354cca056
Alice Sherepa
added a comment - shawn2016 It is also repeatable without setting general_log=1, just after the second execution of the procedure. But sure after MDEV-26115 will be patched - this test should be checked again.
MariaDB [test]> select version();
+-----------------+
| version() |
+-----------------+
| 10.6.16-MariaDB |
+-----------------+
1 row in set (0,000 sec)
MariaDB [test]> delimiter |
MariaDB [test]> CREATE OR REPLACE FUNCTION cnt()
-> RETURNS INTEGER
-> NO SQL
-> BEGIN
-> RETURN 1;
-> END;|
Query OK, 0 rows affected (0,014 sec)
MariaDB [test]> CREATE OR REPLACE PROCEDURE p1()
-> NO SQL
-> BEGIN
-> DECLARE i INTEGER;
-> FOR i IN 1..cnt() DO
-> SELECT i;
-> END FOR;
-> END;|
Query OK, 0 rows affected (0,020 sec)
MariaDB [test]> CALL p1()|
+---+
| i |
+---+
| 1 |
+---+
1 row in set (0,001 sec)
Query OK, 0 rows affected (0,001 sec)
MariaDB [test]> CALL p1()|
ERROR 2013 (HY000): Lost connection to server during query
231121 12:26:33 [ERROR] mysqld got signal 11 ;
Server version: 10.6.16-MariaDB source revision: b83c379420a8846ae4b28768d3c81fa354cca056
sql/signal_handler.cc:238(handle_fatal_signal)[0x55bd6f81ed67]
sigaction.c:0(__restore_rt)[0x7fa891416420]
sql/item.cc:2815(Item_sp::cleanup())[0x55bd6f83f90b]
sql/item_func.h:141(Item_func::cleanup())[0x55bd6f88d068]
sql/sql_parse.cc:1127(cleanup_items(Item*))[0x55bd6f5e6631]
sql/sp_head.cc:1528(sp_head::execute(THD*, bool))[0x55bd6f54c2dc]
psi/mysql_sp.h:79(sp_head::execute_procedure(THD*, List<Item>*))[0x55bd6f54db5f]
sql/sql_parse.cc:3041(do_execute_sp(THD*, sp_head*))[0x55bd6f5e597a]
sql/sql_parse.cc:3284(Sql_cmd_call::execute(THD*))[0x55bd6f5e81ba]
sql/sql_parse.cc:6026(mysql_execute_command(THD*, bool))[0x55bd6f5ef95a]
sql/sql_parse.cc:8052(mysql_parse(THD*, char*, unsigned int, Parser_state*))[0x55bd6f5f371b]
sql/sql_parse.cc:1957(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool))[0x55bd6f5f5b50]
sql/sql_parse.cc:1411(do_command(THD*, bool))[0x55bd6f5f7073]
sql/sql_connect.cc:1416(do_handle_one_connection(CONNECT*, bool))[0x55bd6f6f4f87]
sql/sql_connect.cc:1324(handle_one_connection)[0x55bd6f6f5224]
perfschema/pfs.cc:2204(pfs_spawn_thread)[0x55bd6fa97c8c]
nptl/pthread_create.c:478(start_thread)[0x7fa89140a609]
Query (0x7fa8400131a0): CALL p1()
People
Unassigned
Shawn Yan
Votes:
0Vote for this issue
Watchers:
3Start 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":849.2000000178814,"ttfb":225.2000000178814,"pageVisibility":"visible","entityId":126470,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":1,"journeyId":"a8367f96-7409-4f28-8a33-d88437a7b4cb","navigationType":0,"readyForUser":956.2000000178814,"redirectCount":0,"resourceLoadedEnd":1089,"resourceLoadedStart":235.09999999403954,"resourceTiming":[{"duration":151.7000000178814,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bv2/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":235.09999999403954,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":235.09999999403954,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":386.80000001192093,"responseStart":0,"secureConnectionStart":0},{"duration":151.7000000178814,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2bv2/820016/12ta74/2380add21a9a1006587582385952de73/_/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":235.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":235.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":387.2000000178814,"responseStart":0,"secureConnectionStart":0},{"duration":161,"initiatorType":"script","name":"https://jira.mariadb.org/s/e9b27a47da5fb0f74a35acd57e9847fb-CDN/lu2bv2/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":235.59999999403954,"connectEnd":235.59999999403954,"connectStart":235.59999999403954,"domainLookupEnd":235.59999999403954,"domainLookupStart":235.59999999403954,"fetchStart":235.59999999403954,"redirectEnd":0,"redirectStart":0,"requestStart":235.59999999403954,"responseEnd":396.59999999403954,"responseStart":396.59999999403954,"secureConnectionStart":235.59999999403954},{"duration":192.7000000178814,"initiatorType":"script","name":"https://jira.mariadb.org/s/c32eb0da7ad9831253f8397e6cc26afd-CDN/lu2bv2/820016/12ta74/2380add21a9a1006587582385952de73/_/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":236.09999999403954,"connectEnd":236.09999999403954,"connectStart":236.09999999403954,"domainLookupEnd":236.09999999403954,"domainLookupStart":236.09999999403954,"fetchStart":236.09999999403954,"redirectEnd":0,"redirectStart":0,"requestStart":236.09999999403954,"responseEnd":428.80000001192093,"responseStart":428.80000001192093,"secureConnectionStart":236.09999999403954},{"duration":196.09999999403954,"initiatorType":"script","name":"https://jira.mariadb.org/s/bc0bcb146314416123c992714ee00ff7-CDN/lu2bv2/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":236.30000001192093,"connectEnd":236.30000001192093,"connectStart":236.30000001192093,"domainLookupEnd":236.30000001192093,"domainLookupStart":236.30000001192093,"fetchStart":236.30000001192093,"redirectEnd":0,"redirectStart":0,"requestStart":236.30000001192093,"responseEnd":432.40000000596046,"responseStart":432.30000001192093,"secureConnectionStart":236.30000001192093},{"duration":196.30000001192093,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":236.5,"connectEnd":236.5,"connectStart":236.5,"domainLookupEnd":236.5,"domainLookupStart":236.5,"fetchStart":236.5,"redirectEnd":0,"redirectStart":0,"requestStart":236.5,"responseEnd":432.80000001192093,"responseStart":432.80000001192093,"secureConnectionStart":236.5},{"duration":196.39999997615814,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":236.7000000178814,"connectEnd":236.7000000178814,"connectStart":236.7000000178814,"domainLookupEnd":236.7000000178814,"domainLookupStart":236.7000000178814,"fetchStart":236.7000000178814,"redirectEnd":0,"redirectStart":0,"requestStart":236.7000000178814,"responseEnd":433.09999999403954,"responseStart":433.09999999403954,"secureConnectionStart":236.7000000178814},{"duration":301.09999999403954,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2bv2/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":236.80000001192093,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":236.80000001192093,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":537.9000000059605,"responseStart":0,"secureConnectionStart":0},{"duration":196.59999999403954,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":237,"connectEnd":237,"connectStart":237,"domainLookupEnd":237,"domainLookupStart":237,"fetchStart":237,"redirectEnd":0,"redirectStart":0,"requestStart":237,"responseEnd":433.59999999403954,"responseStart":433.59999999403954,"secureConnectionStart":237},{"duration":301,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2bv2/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":237.09999999403954,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":237.09999999403954,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":538.0999999940395,"responseStart":0,"secureConnectionStart":0},{"duration":196.2999999821186,"initiatorType":"script","name":"https://jira.mariadb.org/s/719848dd97ebe0663199f49a3936487a-CDN/lu2bv2/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":237.7000000178814,"connectEnd":237.7000000178814,"connectStart":237.7000000178814,"domainLookupEnd":237.7000000178814,"domainLookupStart":237.7000000178814,"fetchStart":237.7000000178814,"redirectEnd":0,"redirectStart":0,"requestStart":237.7000000178814,"responseEnd":434,"responseStart":434,"secureConnectionStart":237.7000000178814},{"duration":813.0999999940395,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":270.30000001192093,"connectEnd":270.30000001192093,"connectStart":270.30000001192093,"domainLookupEnd":270.30000001192093,"domainLookupStart":270.30000001192093,"fetchStart":270.30000001192093,"redirectEnd":0,"redirectStart":0,"requestStart":270.30000001192093,"responseEnd":1083.4000000059605,"responseStart":1083.4000000059605,"secureConnectionStart":270.30000001192093},{"duration":766.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":317.40000000596046,"connectEnd":317.40000000596046,"connectStart":317.40000000596046,"domainLookupEnd":317.40000000596046,"domainLookupStart":317.40000000596046,"fetchStart":317.40000000596046,"redirectEnd":0,"redirectStart":0,"requestStart":317.40000000596046,"responseEnd":1083.9000000059605,"responseStart":1083.9000000059605,"secureConnectionStart":317.40000000596046},{"duration":113.90000000596046,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":549.5,"connectEnd":549.5,"connectStart":549.5,"domainLookupEnd":549.5,"domainLookupStart":549.5,"fetchStart":549.5,"redirectEnd":0,"redirectStart":0,"requestStart":549.5,"responseEnd":663.4000000059605,"responseStart":663.4000000059605,"secureConnectionStart":549.5},{"duration":279.5,"initiatorType":"link","name":"https://jira.mariadb.org/s/d5715adaadd168a9002b108b2b039b50-CDN/lu2bv2/820016/12ta74/be4b45e9cec53099498fa61c8b7acba4/_/download/contextbatch/css/jira.project.sidebar,-_super,-project.issue.navigator,-jira.general,-jira.browse.project,-jira.view.issue,-jira.global,-atl.general,-com.atlassian.jira.projects.sidebar.init/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true","startTime":804.9000000059605,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":804.9000000059605,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1084.4000000059605,"responseStart":0,"secureConnectionStart":0},{"duration":279,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/e65b778d185daf5aee24936755b43da6/_/download/contextbatch/js/browser-metrics-plugin.contrib,-_super,-project.issue.navigator,-jira.view.issue,-atl.general/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true","startTime":805.8000000119209,"connectEnd":805.8000000119209,"connectStart":805.8000000119209,"domainLookupEnd":805.8000000119209,"domainLookupStart":805.8000000119209,"fetchStart":805.8000000119209,"redirectEnd":0,"redirectStart":0,"requestStart":805.8000000119209,"responseEnd":1084.800000011921,"responseStart":1084.800000011921,"secureConnectionStart":805.8000000119209},{"duration":289.30000001192093,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":843.4000000059605,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":843.4000000059605,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1132.7000000178814,"responseStart":0,"secureConnectionStart":0},{"duration":282.90000000596046,"initiatorType":"script","name":"https://jira.mariadb.org/s/53a43b6764f587426c7bb9a150184c00-CDN/lu2bv2/820016/12ta74/be4b45e9cec53099498fa61c8b7acba4/_/download/contextbatch/js/jira.project.sidebar,-_super,-project.issue.navigator,-jira.general,-jira.browse.project,-jira.view.issue,-jira.global,-atl.general,-com.atlassian.jira.projects.sidebar.init/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true","startTime":806.0999999940395,"connectEnd":806.0999999940395,"connectStart":806.0999999940395,"domainLookupEnd":806.0999999940395,"domainLookupStart":806.0999999940395,"fetchStart":806.0999999940395,"redirectEnd":0,"redirectStart":0,"requestStart":806.0999999940395,"responseEnd":1089,"responseStart":1089,"secureConnectionStart":806.0999999940395}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":10,"responseStart":225,"responseEnd":317,"domLoading":228,"domInteractive":1139,"domContentLoadedEventStart":1139,"domContentLoadedEventEnd":1199,"domComplete":1358,"loadEventStart":1358,"loadEventEnd":1358,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1092.300000011921},{"name":"bigPipe.sidebar-id.end","time":1093.0999999940395},{"name":"bigPipe.activity-panel-pipe-id.start","time":1093.2000000178814},{"name":"bigPipe.activity-panel-pipe-id.end","time":1099.5},{"name":"activityTabFullyLoaded","time":1222.300000011921}],"measures":[],"correlationId":"8bea1c49a1885a","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":117,"dbReadsTimeInMs":12,"dbConnsTimeInMs":20,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
The stack trace contains _ZN7Item_sp7cleanupEv+0x1f, which is near the start of the following function:
void
Item_sp::cleanup()
{
free_root(&sp_mem_root, MYF(0));
}
Without seeing the compiled code, I can only guess, but I think that it is plausible that this crashes in one of the delete statements when invoking an inlined destructor. Could it be that this=nullptr here? A full stack trace of the crash would help a lot. I’m not deeply familiar with Docker or the pre-made MariaDB containers. You may need https://quay.io/repository/mariadb-foundation/mariadb-debug which should allow you to obtain a resolved stack trace from GDB.