[MDEV-11501] mysqld got exception 0xc0000005 at mysqld.exe!Item_subselect::const_item()[item_subselect.cc:877] Created: 2016-12-07  Updated: 2016-12-09  Resolved: 2016-12-09

Status: Closed
Project: MariaDB Server
Component/s: Optimizer
Affects Version/s: 10.0.28
Fix Version/s: 5.5.54, 10.0.29, 10.1.20, 10.2.3

Type: Bug Priority: Major
Reporter: Ryan Southwell Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None
Environment:

multiple Windows-based environments confirmed, including MySQL v5.6.28


Attachments: File QueryOfDeath_TestDB.sql    

 Description   

May be related or duplicate of MDEV-10776

Given test DB as attached to issue, executing or explaining the following query:

Select Computers.ComputerId,IFNULL((SELECT MAX(FoundThreatId) as `LastThreatId` FROM antivirusthreats WHERE `ComputerId`=`computers`.`computerid`), -1) as `LastThreatId`,IFNULL(`Virusscanners`.`Name`, '') as `Icon`,IFNULL(`Virusscanners`.`Name`, 'None Found') as `Virus Scanner`,`Computers`.`Name` as `Computer Name`,CASE `Computers`.`VirusAP` WHEN 0 THEN 'Not Running' WHEN 1 THEN 'Running' END as `Scanner Status`,IF(LENGTH(`Computers`.`VirusDefs`) = 8, CONCAT(SUBSTRING(`Computers`.`VirusDefs`,5,2),'/',SUBSTRING(`Computers`.`VirusDefs`,7,2),'/',SUBSTRING(`Computers`.`VirusDefs`,1,4)), 'None Found') as `Virus Definitions`,IFNULL((SELECT MAX(DateOccurred) FROM antivirusthreats WHERE computerId=`Computers`.`ComputerId`), 'None Found') as `Time of Last Threat`,IFNULL((SELECT ThreatName FROM antivirusthreats LEFT JOIN antivirusthreatlookup ON antivirusthreats.AvThreatId=antivirusthreatlookup.avthreatid WHERE FoundThreatId=`LastThreatId`), 'None Found') as `Last Threat Found`,IFNULL((SELECT ActionTaken FROM antivirusthreats  LEFT JOIN antivirusthreatlookup ON antivirusthreats.AvThreatId=antivirusthreatlookup.avthreatid  WHERE FoundThreatId=`LastThreatId`), 'None Found') as `Action Taken`, ComputerId as `Hidden_ComputerID`  FROM Computers LEFT JOIN Virusscanners ON Computers.VirusScanner=Virusscanners.VScanId   WHERE  `Computers`.`ComputerId` IN (SELECT ComputerId FROM usersec WHERE UserId=15)  ORDER BY IFNULL((SELECT MAX(DateOccurred) FROM antivirusthreats WHERE computerId=`Computers`.`ComputerId`), 'None Found') ASC LIMIT 0,30

Results in the following crash / trap:

Server version: 10.0.28-MariaDB
key_buffer_size=30408704
read_buffer_size=65536
max_used_connections=97
max_threads=501
thread_count=96
It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 243002 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.
 
Thread pointer: 0x0x40e9a9dd78
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...
mysqld.exe!Item_subselect::const_item()[item_subselect.cc:877]
mysqld.exe!st_select_lex::optimize_unflattened_subqueries()[sql_lex.cc:3498]
mysqld.exe!JOIN::optimize_constant_subqueries()[opt_subselect.cc:5076]
mysqld.exe!JOIN::optimize_inner()[sql_select.cc:1129]
mysqld.exe!JOIN::optimize()[sql_select.cc:1024]
mysqld.exe!mysql_select()[sql_select.cc:3294]
mysqld.exe!mysql_explain_union()[sql_select.cc:24120]
mysqld.exe!execute_sqlcom_select()[sql_parse.cc:5251]
mysqld.exe!mysql_execute_command()[sql_parse.cc:2563]
mysqld.exe!mysql_parse()[sql_parse.cc:6575]
mysqld.exe!dispatch_command()[sql_parse.cc:1312]
mysqld.exe!do_command()[sql_parse.cc:1007]
mysqld.exe!threadpool_process_request()[threadpool_common.cc:271]
mysqld.exe!io_completion_callback()[threadpool_win.cc:568]
KERNEL32.DLL!VirtualUnlock()
ntdll.dll!RtlGetActiveActivationContext()
ntdll.dll!RtlFreeUnicodeString()
KERNEL32.DLL!BaseThreadInitThunk()
ntdll.dll!RtlUserThreadStart()
 
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0x40e8351b00): explain Select Computers.ComputerId,IFNULL((SELECT MAX(FoundThreatId) as `LastThreatId` FROM antivirusthreats WHERE `ComputerId`=`computers`.`computerid`), -1) as `LastThreatId`,IFNULL(`Virusscanners`.`Name`, '') as `Icon`,IFNULL(`Virusscanners`.`Name`, 'None Found') as `Virus Scanner`,`Computers`.`Name` as `Computer Name`,CASE `Computers`.`VirusAP` WHEN 0 THEN 'Not Running' WHEN 1 THEN 'Running' END as `Scanner Status`,IF(LENGTH(`Computers`.`VirusDefs`) = 8, CONCAT(SUBSTRING(`Computers`.`VirusDefs`,5,2),'/',SUBSTRING(`Computers`.`VirusDefs`,7,2),'/',SUBSTRING(`Computers`.`VirusDefs`,1,4)), 'None Found') as `Virus Definitions`,IFNULL((SELECT MAX(DateOccurred) FROM antivirusthreats WHERE computerId=`Computers`.`ComputerId`), 'None Found') as `Time of Last Threat`,IFNULL((SELECT ThreatName FROM antivirusthreats LEFT JOIN antivirusthreatlookup ON antivirusthreats.AvThreatId=antivirusthreatlookup.avthreatid WHERE FoundThreatId=`LastThreatId`), 'None Found') as `Last Threat Found`,IFNULL((SELECT ActionTaken FROM antivirusthreats  LEFT JOIN antivirusthreatlookup ON antivirusthreats.AvThreatId=antivirusthreatlookup.avthreatid  WHERE FoundThreatId=`LastThreatId`), 'None Found') as `Action Taken`, ComputerId as `Hidden_ComputerID`  FROM Computers LEFT JOIN Virusscanners ON Computers.VirusScanner=Virusscanners.VScanId   WHERE  `Computers`.`ComputerId` IN (SELECT ComputerId FROM usersec WHERE UserId=15)  ORDER BY IFNULL((SELECT MAX(DateOccurred) FROM antivirusthreats WHERE computerId=`Computers`.`ComputerId`), 'None Found') ASC LIMIT 0,30
Connection ID (thread ID): 98
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=on,exists_to_in=on



 Comments   
Comment by Elena Stepanova [ 2016-12-09 ]

Thanks for the report and the test case.
It was indeed fixed by the patch for MDEV-10776.

Generated at Thu Feb 08 07:50:26 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.