Bug #107531 SIGNAL hangs if used with MYSQL_ERRNO=65535
Submitted: 9 Jun 2022 20:12 Modified: 20 Jun 2022 16:26
Reporter: C. Deniz Akyuz Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:8.0.28 OS:Any
Assigned to: CPU Architecture:Any
Tags: 65535, MYSQL_ERRNO, signal

[9 Jun 2022 20:12] C. Deniz Akyuz
Description:
The SIGNAL statement hangs if used with MYSQL_ERRNO=65535

How to repeat:
-- -----
SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'mysql-errno 65534 works', MYSQL_ERRNO = 65534;
-- -----
SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'mysql-errno 65536 fails', MYSQL_ERRNO = 65536;
-- -----
SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'mysql-errno 65535 hangs', MYSQL_ERRNO = 65535;
-- -----

Suggested fix:
The SIGNAL statement should work with MYSQL_ERRNO=65535 i.e. the MAX UNSIGNED SMALLINT
[10 Jun 2022 12:08] MySQL Verification Team
Hi Mr. Akyuz,

Thank you for your bug report.

However, it is not a bug.

MYSQL_ERRNO is indeed of the type that you have indicated. However, the range of that variable goes up to 13854. You should not use numbers for that variable, but it's enumerated values, like ER_SIGNAL_WARN etc .......

If you want to raise signals, you are supposed to know our API's where those values are defined by their enumerated values.

Not a bug.
[10 Jun 2022 16:19] C. Deniz Akyuz
OK. I understand (and I am not using them in my work). 

But is it designed and documented that using the invalid error-number 65535 when raising a signal should "hang"? 

If it is not a valid number, I would expect it to rather fail instead of indefinitely hanging. 

Is "hanging" with any input not considered a bug? (Or is it the desired behavior?)
[11 Jun 2022 20:55] C. Deniz Akyuz
SIGNAL command should not hang regardless of the input. It should fail or work.
[20 Jun 2022 16:26] C. Deniz Akyuz
SIGNAL command hangs.
SIGNAL command should fail or succeed not hang.

SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'hangs', MYSQL_ERRNO = 65535;
[21 Jun 2022 11:52] MySQL Verification Team
Hi ,

We agree that it should be documented .....