[MDEV-16233] Update w/ sub-query causes signal 11 crash Created: 2018-05-21  Updated: 2019-11-18

Status: Open
Project: MariaDB Server
Component/s: Data Manipulation - Subquery, Data Manipulation - Update
Affects Version/s: 5.5.56
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Kevin Seymour Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Environment:

RHEL 7.4


Issue Links:
Duplicate
duplicates MDEV-11566 Server crashes in get_store_key / cre... Closed

 Description   

When executing an update involving a sub-query the database crashes. Commenting out the last sub-query in the update will allow the query to execute (although not with the right results). The crash is consistent and can be recreated.

UPDATE dcs.dcs_item di
SET di.current_level =
(SELECT dsd.status_code
FROM dcs.dcs_status_definition dsd
WHERE dsd.description = 'Deployed To QA')
WHERE di.current_level =
(SELECT dsd.status_code
FROM dcs.dcs_status_definition dsd
WHERE dsd.description = 'HOLD')
AND di.change_request_id IN
(SELECT r.id
FROM requests.requests r,
requests.release re,
requests.datacenter dc
WHERE r.release_id = re.release_id
AND re.datacenter_id = dc.datacenter_id
AND dc.datacenter_id = 2
AND re.automated_build = 1);

Version: '5.5.56-MariaDB' socket: '/var/lib/mysql/mysql.sock' port: 3306 MariaDB Server
180521 9:33:57 [ERROR] mysqld got signal 11 ;
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 http://kb.askmonty.org/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: 5.5.56-MariaDB
key_buffer_size=536870912
read_buffer_size=131072
max_used_connections=7
max_threads=153
thread_count=1
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 859927 K bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0x56256bd77c90
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...
stack_bottom = 0x7f2e20220dc0 thread_stack 0x48000
/usr/libexec/mysqld(my_print_stacktrace+0x3d)[0x5625691d496d]
/usr/libexec/mysqld(handle_fatal_signal+0x515)[0x562568dea285]
/lib64/libpthread.so.0(+0xf5e0)[0x7f2e246be5e0]
/usr/libexec/mysqld(+0x396724)[0x562568cde724]
/usr/libexec/mysqld(_Z20get_best_combinationP4JOIN+0x35b)[0x562568ce4dcb]
/usr/libexec/mysqld(+0x3b73b3)[0x562568cff3b3]
/usr/libexec/mysqld(_ZN4JOIN8optimizeEv+0x675)[0x562568d02625]
/usr/libexec/mysqld(_ZN13st_select_lex31optimize_unflattened_subqueriesEb+0xc8)[0x562568cb1b18]
/usr/libexec/mysqld(Z12mysql_updateP3THDP10TABLE_LISTR4ListI4ItemES6_PS4_jP8st_ordery15enum_duplicatesbPySB+0x3f9)[0x562568d43359]
/usr/libexec/mysqld(_Z21mysql_execute_commandP3THD+0x2de5)[0x562568cbc815]
/usr/libexec/mysqld(_Z11mysql_parseP3THDPcjP12Parser_state+0x125)[0x562568cc08c5]
/usr/libexec/mysqld(_Z16dispatch_command19enum_server_commandP3THDPcj+0x1753)[0x562568cc2923]
/usr/libexec/mysqld(_Z24do_handle_one_connectionP3THD+0x1c2)[0x562568d74632]
/usr/libexec/mysqld(handle_one_connection+0x4a)[0x562568d746da]
/lib64/libpthread.so.0(+0x7e25)[0x7f2e246b6e25]
/lib64/libc.so.6(clone+0x6d)[0x7f2e22eb434d]

Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0x7f2dc80eec98): UPDATE dcs.dcs_item di SET di.current_level = (SELECT dsd.status_code FROM dcs.dcs_status_definition dsd WHERE dsd.description = 'Deployed To QA') WHERE di.current_level = (SELECT dsd.status_code FROM dcs.dcs_status_definition dsd WHERE dsd.description = 'HOLD') AND di.change_request_id IN (SELECT r.id FROM requests.requests r, requests.release re, requests.datacenter dc WHERE r.release_id = re.release_id AND re.datacenter_id = dc.datacenter_id AND dc.datacenter_id = 2 AND re.automated_build = 1)
Connection ID (thread ID): 58294
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=off,table_elimination=on,extended_keys=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.
180521 09:33:57 mysqld_safe Number of processes running now: 0
180521 09:33:57 mysqld_safe mysqld restarted
180521 9:33:57 [Note] /usr/libexec/mysqld (mysqld 5.5.56-MariaDB) starting as process 38127 ...
180521 9:33:57 InnoDB: The InnoDB memory heap is disabled
180521 9:33:57 InnoDB: Mutexes and rw_locks use GCC atomic builtins
180521 9:33:57 InnoDB: Compressed tables use zlib 1.2.7
180521 9:33:57 InnoDB: Using Linux native AIO
180521 9:33:57 InnoDB: Initializing buffer pool, size = 128.0M
180521 9:33:57 InnoDB: Completed initialization of buffer pool
180521 9:33:57 InnoDB: highest supported file format is Barracuda.
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
InnoDB: Restoring possible half-written data pages from the doublewrite buffer...
180521 9:33:57 InnoDB: Waiting for the background threads to start
180521 9:33:58 Percona XtraDB (http://www.percona.com) 5.5.52-MariaDB-38.3 started; log sequence number 167870375
180521 9:33:59 [Note] Plugin 'FEEDBACK' is disabled.
180521 9:33:59 [Note] Server socket created on IP: '0.0.0.0'.
180521 9:33:59 [Note] Event Scheduler: Loaded 0 events
180521 9:33:59 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.5.56-MariaDB' socket: '/var/lib/mysql/mysql.sock' port: 3306 MariaDB Server



 Comments   
Comment by Kevin Seymour [ 2018-05-21 ]

Re-structuring the query with an EXISTS instead of an IN allows proper execution.

UPDATE dcs.dcs_item di
SET di.current_level =
(SELECT dsd.status_code
FROM dcs.dcs_status_definition dsd
WHERE dsd.description = 'Deployed To QA')
WHERE di.current_level =
(SELECT dsd.status_code
FROM dcs.dcs_status_definition dsd
WHERE dsd.description = 'HOLD')
AND EXISTS
(SELECT NULL
FROM requests.requests r,
requests.release re,
requests.datacenter dc
WHERE r.id = di.change_request_id
AND r.release_id = re.release_id
AND re.datacenter_id = dc.datacenter_id
AND dc.datacenter_id = 2
AND re.automated_build = 1);

Comment by Alice Sherepa [ 2019-10-09 ]

Hi Kevin,
Sorry for the delayed response. Are you still able to reproduce the issue? It might be related to the MDEV-11566, which is unfortunately not fixed yet.
Could you please add table structures for dcs.dcs_item, dcs.dcs_status_definition, requests.requests, requests.release , requests.datacenter?
Thanks!

Comment by Kevin Seymour [ 2019-10-09 ]

Hi Alice,
Here are describes for the tables.

MariaDB [(none)]> desc dcs.dcs_item;
------------------------------------------------------------------+

Field Type Null Key Default Extra

------------------------------------------------------------------+

dcs_id int(10) unsigned NO PRI NULL auto_increment
description varchar(255) NO      
objects longtext NO   NULL  
notes longtext NO   NULL  
dcs_user_id int(10) unsigned NO MUL 0  
deploy_date date NO   0000-00-00  
add_data date NO   0000-00-00  
type int(10) unsigned NO MUL 0  
change_request_id int(11) YES MUL NULL  
current_level int(11) YES MUL NULL  
affects_inventory int(11) YES   NULL  
db_schema_id int(11) unsigned YES   NULL  

------------------------------------------------------------------+
12 rows in set (0.00 sec)

MariaDB [(none)]> desc dcs.dcs_status_definition;
---------------------------------------------+

Field Type Null Key Default Extra

---------------------------------------------+

status_code int(11) NO PRI NULL  
description varchar(30) YES   NULL  
color varchar(20) YES   NULL  
active_status char(1) YES   A  
list_order int(11) NO   NULL  

---------------------------------------------+
5 rows in set (0.00 sec)

MariaDB [(none)]> desc requests.requests;
---------------------------------------------------------------------+

Field Type Null Key Default Extra

---------------------------------------------------------------------+

id int(10) unsigned NO PRI 0  
priority_rank int(10) unsigned YES   NULL  
es3_priority int(10) unsigned NO MUL 0  
customer_priority int(10) unsigned NO MUL 0  
area int(10) unsigned NO MUL 0  
request_desc varchar(200) NO   NULL  
user_id int(10) unsigned NO MUL 0  
integration_id int(10) unsigned NO MUL 0  
customer_contact_id int(10) unsigned NO MUL 0  
summary text NO   NULL  
billable char(1) NO      
proposed_cost int(10) unsigned zerofill NO   0000000000  
es3_cost int(10) unsigned zerofill NO   0000000000  
customer_cost int(10) unsigned zerofill NO   0000000000  
benefits varchar(200) YES   NULL  
expected_es3_savings varchar(200) YES   NULL  
project_status int(10) unsigned NO MUL 0  
production_dt datetime YES   NULL  
request_status int(10) unsigned NO MUL 0  
comments text YES   NULL  
entry_dt datetime YES   NULL  
Request_type int(1) YES   NULL  
uat_resource varchar(300) YES   NULL  
risks varchar(2000) YES   NULL  
training varchar(2000) YES   NULL  
load_performance varchar(2000) YES   NULL  
pay_associated varchar(2000) YES   NULL  
type varchar(1) YES   NULL  
deployed_date date YES   NULL  
developer varchar(60) YES   NULL  
unit_test_dt date YES   NULL  
approved_for_qa_flg char(1) YES   NULL  
uat_test_complete_dt date YES   NULL  
disable enum('0','1') NO   0  
ticket_nbr mediumtext YES   NULL  
release_id int(11) YES MUL NULL  

---------------------------------------------------------------------+
36 rows in set (0.00 sec)

MariaDB [(none)]> desc requests.release;
---------------------------------------------------------------+

Field Type Null Key Default Extra

---------------------------------------------------------------+

Release_ID int(11) NO PRI NULL auto_increment
Release_date datetime NO MUL NULL  
Datacenter_ID int(11) NO   NULL  
release_status_id int(11) NO   NULL  
Automated_build int(11) NO MUL 0  
Entry_user varchar(60) NO   NULL  
Entry_dt datetime NO   NULL  
Update_user varchar(100) YES   NULL  
Update_dt datetime YES   NULL  
show_in_release_notes int(11) YES   0  
comments varchar(100) YES   NULL  

---------------------------------------------------------------+
11 rows in set (0.00 sec)

MariaDB [(none)]> desc requests.datacenter;
---------------------------------------------------------+

Field Type Null Key Default Extra

---------------------------------------------------------+

Datacenter_ID int(11) NO PRI NULL auto_increment
Datacenter_name varchar(100) NO UNI NULL  
Entry_user varchar(60) NO   NULL  
Entry_dt datetime NO   NULL  
Update_user varchar(100) YES   NULL  
Update_dt datetime YES   NULL  

---------------------------------------------------------+
6 rows in set (0.00 sec)

Here are the CREATE TABLE statements.

CREATE TABLE `dcs_item` (
`dcs_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`description` varchar(255) NOT NULL DEFAULT '',
`objects` longtext NOT NULL,
`notes` longtext NOT NULL,
`dcs_user_id` int(10) unsigned NOT NULL DEFAULT '0',
`deploy_date` date NOT NULL DEFAULT '0000-00-00',
`add_data` date NOT NULL DEFAULT '0000-00-00',
`type` int(10) unsigned NOT NULL DEFAULT '0',
`change_request_id` int(11) DEFAULT NULL,
`current_level` int(11) DEFAULT NULL,
`affects_inventory` int(11) DEFAULT NULL,
`db_schema_id` int(11) unsigned DEFAULT NULL,
PRIMARY KEY (`dcs_id`),
KEY `TYPE` (`type`),
KEY `DCS_USER_ID` (`dcs_user_id`),
KEY `current_level` (`current_level`),
KEY `change_request_id` (`change_request_id`)
) ENGINE=InnoDB AUTO_INCREMENT=27883 DEFAULT CHARSET=latin1;

CREATE TABLE `dcs_status_definition` (
`status_code` int(11) NOT NULL,
`description` varchar(30) DEFAULT NULL,
`color` varchar(20) DEFAULT NULL,
`active_status` char(1) DEFAULT 'A' COMMENT 'Used by DCS to determine if the status is Active (A) or Inactve (I), example: Certified = I, Submitted for Review = A',
`list_order` int(11) NOT NULL COMMENT 'number used to order list shown to user',
PRIMARY KEY (`status_code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `requests` (
`id` int(10) unsigned NOT NULL DEFAULT '0',
`priority_rank` int(10) unsigned DEFAULT NULL,
`es3_priority` int(10) unsigned NOT NULL DEFAULT '0',
`customer_priority` int(10) unsigned NOT NULL DEFAULT '0',
`area` int(10) unsigned NOT NULL DEFAULT '0',
`request_desc` varchar(200) NOT NULL,
`user_id` int(10) unsigned NOT NULL DEFAULT '0',
`integration_id` int(10) unsigned NOT NULL DEFAULT '0',
`customer_contact_id` int(10) unsigned NOT NULL DEFAULT '0',
`summary` text NOT NULL,
`billable` char(1) NOT NULL DEFAULT '',
`proposed_cost` int(10) unsigned zerofill NOT NULL DEFAULT '0000000000',
`es3_cost` int(10) unsigned zerofill NOT NULL DEFAULT '0000000000',
`customer_cost` int(10) unsigned zerofill NOT NULL DEFAULT '0000000000',
`benefits` varchar(200) DEFAULT NULL,
`expected_es3_savings` varchar(200) DEFAULT NULL,
`project_status` int(10) unsigned NOT NULL DEFAULT '0',
`production_dt` datetime DEFAULT NULL,
`request_status` int(10) unsigned NOT NULL DEFAULT '0',
`comments` text,
`entry_dt` datetime DEFAULT NULL,
`Request_type` int(1) DEFAULT NULL COMMENT 'P = Project B = Bug',
`uat_resource` varchar(300) DEFAULT NULL,
`risks` varchar(2000) DEFAULT NULL,
`training` varchar(2000) DEFAULT NULL,
`load_performance` varchar(2000) DEFAULT NULL,
`pay_associated` varchar(2000) DEFAULT NULL,
`type` varchar(1) DEFAULT NULL,
`deployed_date` date DEFAULT NULL,
`developer` varchar(60) DEFAULT NULL,
`unit_test_dt` date DEFAULT NULL,
`approved_for_qa_flg` char(1) DEFAULT NULL,
`uat_test_complete_dt` date DEFAULT NULL,
`disable` enum('0','1') NOT NULL DEFAULT '0' COMMENT 'Column to state whether item is active for dropdown',
`ticket_nbr` mediumtext,
`release_id` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `Index_2` (`es3_priority`),
KEY `FK_requests_3` (`area`),
KEY `FK_requests_4` (`user_id`),
KEY `FK_requests_5` (`integration_id`),
KEY `FK_requests_7` (`project_status`),
KEY `FK_requests_8` (`request_status`),
KEY `FK_requests_6` (`customer_contact_id`),
KEY `FK_requests_11` (`customer_contact_id`),
KEY `FK_requests_2` (`customer_priority`),
KEY `Release_id_index` (`release_id`),
CONSTRAINT `FK_requests_1` FOREIGN KEY (`es3_priority`) REFERENCES `es3_priority` (`id`),
CONSTRAINT `FK_requests_2` FOREIGN KEY (`customer_priority`) REFERENCES `customer_priority` (`id`),
CONSTRAINT `FK_requests_3` FOREIGN KEY (`area`) REFERENCES `area` (`id`),
CONSTRAINT `FK_requests_4` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`),
CONSTRAINT `FK_requests_5` FOREIGN KEY (`integration_id`) REFERENCES `integration_contact` (`id`),
CONSTRAINT `FK_requests_6` FOREIGN KEY (`customer_contact_id`) REFERENCES `customer_contact` (`id`),
CONSTRAINT `FK_requests_7` FOREIGN KEY (`project_status`) REFERENCES `project_status` (`id`),
CONSTRAINT `FK_requests_8` FOREIGN KEY (`request_status`) REFERENCES `request_status` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `release` (
`Release_ID` int(11) NOT NULL AUTO_INCREMENT,
`Release_date` datetime NOT NULL COMMENT 'Deployment date',
`Datacenter_ID` int(11) NOT NULL COMMENT 'Datacenter id, York or Optical/HMN',
`release_status_id` int(11) NOT NULL,
`Automated_build` int(11) NOT NULL DEFAULT '0' COMMENT '0=Not automated build, 1=automated build',
`Entry_user` varchar(60) NOT NULL,
`Entry_dt` datetime NOT NULL,
`Update_user` varchar(100) DEFAULT NULL,
`Update_dt` datetime DEFAULT NULL,
`show_in_release_notes` int(11) DEFAULT '0',
`comments` varchar(100) DEFAULT NULL,
PRIMARY KEY (`Release_ID`),
UNIQUE KEY `Release_ID_UNIQUE` (`Release_ID`),
KEY `Release_date_NORMAL` (`Release_date`),
KEY `Automated_build_NORMAL` (`Automated_build`)
) ENGINE=InnoDB AUTO_INCREMENT=193 DEFAULT CHARSET=latin1;

CREATE TABLE `datacenter` (
`Datacenter_ID` int(11) NOT NULL AUTO_INCREMENT,
`Datacenter_name` varchar(100) NOT NULL COMMENT 'York or Optical/HMN',
`Entry_user` varchar(60) NOT NULL,
`Entry_dt` datetime NOT NULL,
`Update_user` varchar(100) DEFAULT NULL,
`Update_dt` datetime DEFAULT NULL,
PRIMARY KEY (`Datacenter_ID`),
UNIQUE KEY `Datacenter_name_UNIQUE` (`Datacenter_name`),
UNIQUE KEY `Datacenter_ID_UNIQUE` (`Datacenter_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;

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