MySQL Com. Server 8.0.22 crashing when twice invoking stored procedure
I have already opened a MySQL bug report on this issue (https://bugs.mysql.com/bug.php?id=101505, the report is no longer visible to the public), but I am also posting here in case anyone has any feedback or ideas for a workaround.
The following stored procedure and its specific invocation yield an immediate server crash. I suspect that this is somehow related to some other reports of 8.0.22 server crashes that I have seen on this forum and on Stack Overflow (see
https://stackoverflow.com/questions/64440469/mysql-server-restarts-after-trigger-execution,
https://forums.mysql.com/read.php?20,690974,690974#msg-690974).
-- Start script demonstrating v8.0.22 crash
CREATE DATABASE IF NOT EXISTS `DisposableSchema`;
DROP PROCEDURE IF EXISTS `DisposableSchema`.`spCrasher`;
DELIMITER $$
CREATE PROCEDURE `DisposableSchema`.`spCrasher`(
`arg`INT
) BEGIN
UPDATE `tbFoo`
JOIN (SELECT 1) AS T(n)
SET `tbFoo`.`dummy` = 1
WHERE
`tbFoo`.`id` = 1 AND
`arg` >= 2
;
END$$
DELIMITER ;
DROP TEMPORARY TABLE IF EXISTS `DisposableSchema`.`tbFoo`;
CREATE TEMPORARY TABLE `DisposableSchema`.`tbFoo`( `id` INT, `dummy` INT);
INSERT INTO `DisposableSchema`.`tbFoo`( `id` ) VALUES( 1 );
CALL `DisposableSchema`.`spCrasher`(2);
SELECT 'The following CALL statement causes the server crash';
CALL `DisposableSchema`.`spCrasher`(1); -- Crashes
SELECT 'This message will not be seen';
-- End script demonstrating v8.0.22 crash
Note the following:
- It is the second CALL statement that causes the crash, but _only_ when invoked following the first CALL statement. There is no crash when only invoking the 2nd CALL.
- Changing the stored procedure `arg` value in the second call from 1 to anything >= 2 (corresponding to the WHERE clause filter on `arg` in the sproc) eliminates the crash.
- If you remove the JOIN in the sproc there is no crash.
- If you remove the filter on `tbFoo`.`id` in the sproc WHERE clause there is no crash.