Bug #113352 User cancel operation times out when stored procedure has multiple SLEEP() calls
Submitted: 6 Dec 2023 15:26 Modified: 7 Dec 2023 10:46
Reporter: dba all Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:8.0.35 OS:Any
Assigned to: CPU Architecture:Any

[6 Dec 2023 15:26] dba all
Description:
Whenever a stored procedure has more than one sleep call inside it, user cancel request is timing out when there are more than 5 seconds left during SLEEP call before last SLEEP call.

How to repeat:
DELIMITER $$
CREATE PROCEDURE sp_sleep()
BEGIN
   DO SLEEP(10);
   DO SLEEP(10);
END
$$
DELIMITER ;

CALL sp_sleep; -- (cancel run before 5 seconds have passed)

You will get:
"Cancel operation timed out"
[7 Dec 2023 10:46] MySQL Verification Team
Hi Mr. all,

Thank you very much for your bug report.

However, it is not a bug.

This is due to the fact that SLEEP() does not check for anything, hence any external operation is timed out, due to SLEEP() has to finish it's run.

SLEEP() is actually calling an OS specific call, in order to save resources.

Not a bug.