[MDEV-20338] Server crashes in check_fields upon 2nd execution of SP with UPDATE on app-versioned table Created: 2019-08-13  Updated: 2020-05-23  Resolved: 2020-05-23

Status: Closed
Project: MariaDB Server
Component/s: Stored routines, Versioned Tables
Affects Version/s: 10.4
Fix Version/s: 10.4.11

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Aleksey Midenkov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-20497 Server crashes in Item_field::used_ta... Closed
relates to MDEV-21144 Wrong result or server crash in Item_... Closed

 Description   

CREATE TABLE t1 (a INT);
 
CREATE TABLE t2 (c1 INT, s DATE, e DATE, PERIOD FOR app(s,e));
CREATE PROCEDURE sp() UPDATE t2 FOR PORTION OF app FROM '2019-05-01' TO '2019-10-31' SET c1 = 1 WHERE c1 != 1; 
LOCK TABLE t1 READ ;
--error ER_TABLE_NOT_LOCKED
CALL sp;
UNLOCK TABLES;
CALL sp;
 
# Cleanup
DROP PROCEDURE sp;
DROP TABLE t1, t2;

10.4 13f36fff

#3  <signal handler called>
#4  0x0000560071375ab4 in check_fields (thd=0x7f4b20000b00, table=0x7f4b20194920, items=..., update_view=false) at /data/src/10.4/sql/sql_update.cc:194
#5  0x000056007137696f in mysql_update (thd=0x7f4b20000b00, table_list=0x7f4b20194920, fields=..., values=..., conds=0x7f4b201980c8, order_num=0, order=0x0, limit=18446744073709551615, ignore=false, found_return=0x7f4b840d1930, updated_return=0x7f4b840d19f0) at /data/src/10.4/sql/sql_update.cc:473
#6  0x0000560071272f28 in mysql_execute_command (thd=0x7f4b20000b00) at /data/src/10.4/sql/sql_parse.cc:4376
#7  0x000056007118c93d in sp_instr_stmt::exec_core (this=0x7f4b20198210, thd=0x7f4b20000b00, nextp=0x7f4b840d2704) at /data/src/10.4/sql/sp_head.cc:3607
#8  0x000056007118bc9a in sp_lex_keeper::reset_lex_and_exec_core (this=0x7f4b20198258, thd=0x7f4b20000b00, nextp=0x7f4b840d2704, open_tables=false, instr=0x7f4b20198210) at /data/src/10.4/sql/sp_head.cc:3335
#9  0x000056007118c4e2 in sp_instr_stmt::execute (this=0x7f4b20198210, thd=0x7f4b20000b00, nextp=0x7f4b840d2704) at /data/src/10.4/sql/sp_head.cc:3513
#10 0x0000560071186102 in sp_head::execute (this=0x7f4b20193518, thd=0x7f4b20000b00, merge_da_on_success=true) at /data/src/10.4/sql/sp_head.cc:1346
#11 0x0000560071188a79 in sp_head::execute_procedure (this=0x7f4b20193518, thd=0x7f4b20000b00, args=0x7f4b200058e8) at /data/src/10.4/sql/sp_head.cc:2288
#12 0x000056007126ec2d in do_execute_sp (thd=0x7f4b20000b00, sp=0x7f4b20193518) at /data/src/10.4/sql/sql_parse.cc:3019
#13 0x000056007126f820 in Sql_cmd_call::execute (this=0x7f4b20012fe0, thd=0x7f4b20000b00) at /data/src/10.4/sql/sql_parse.cc:3261
#14 0x000056007127a30f in mysql_execute_command (thd=0x7f4b20000b00) at /data/src/10.4/sql/sql_parse.cc:6098
#15 0x000056007127f57f in mysql_parse (thd=0x7f4b20000b00, rawbuf=0x7f4b20012f18 "CALL sp_grammar2", length=16, parser_state=0x7f4b840d41c0, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7908
#16 0x000056007126b828 in dispatch_command (command=COM_QUERY, thd=0x7f4b20000b00, packet=0x7f4b201426f1 "CALL sp_grammar2 ", packet_length=17, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1843
#17 0x0000560071269f6e in do_command (thd=0x7f4b20000b00) at /data/src/10.4/sql/sql_parse.cc:1360
#18 0x00005600713e3b02 in do_handle_one_connection (connect=0x560074765b80) at /data/src/10.4/sql/sql_connect.cc:1404
#19 0x00005600713e3851 in handle_one_connection (arg=0x560074765b80) at /data/src/10.4/sql/sql_connect.cc:1306
#20 0x00007f4b893fa4a4 in start_thread (arg=0x7f4b840d5700) at pthread_create.c:456
#21 0x00007f4b87942d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97

Non-debug build crashes the same way.



 Comments   
Comment by Elena Stepanova [ 2020-05-16 ]

Doesn't fail on the current 10.4 a4996f95 or 10.5 69077dea

Comment by Elena Stepanova [ 2020-05-23 ]

The failure disappeared from 10.4 branch after this merge:

commit a15234bf4bf98d7833996284c033fc53a981f5d4
Merge: 9a621200899 e5e5877740f
Author: Oleksandr Byelkin
Date:   Mon Dec 9 15:09:41 2019 +0100
 
    Merge branch '10.3' into 10.4

apparently, due to this commit:

commit f6d8640d678799244cd9aede6abfd4493e139665
Author: Aleksey Midenkov
Date:   Tue Dec 3 21:26:44 2019 +0300
 
    MDEV-18929 2nd execution of SP does not detect ER_VERS_NOT_VERSIONED

Generated at Thu Feb 08 08:58:42 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.