Details
-
Bug
-
Status: Stalled (View Workflow)
-
Critical
-
Resolution: Unresolved
-
10.5, 10.6, 10.4.14, 10.5.10, 10.6.3, 10.3(EOL), 10.4(EOL)
-
Linux CentOS 7.7
Description
When a stored function is used to provide the upper bound of a FOR loop, the server crashes. Example:
delimiter //
|
|
CREATE OR REPLACE FUNCTION cnt() |
RETURNS INTEGER |
NO SQL |
BEGIN
|
RETURN 1; |
END; |
//
|
|
CREATE OR REPLACE PROCEDURE p1() |
NO SQL |
BEGIN
|
DECLARE i INTEGER; |
FOR i IN 1..cnt() DO |
SELECT i; |
END FOR; |
END; |
//
|
Calling this will crash the server on the second attempt:
MariaDB [test]> CALL p1();
|
+---+ |
| i |
|
+---+ |
| 1 |
|
+---+ |
1 row in set (0.002 sec) |
|
Query OK, 0 rows affected (0.002 sec) |
|
MariaDB [test]> CALL p1();
|
ERROR 2013 (HY000): Lost connection to MySQL server during query |
The effect is the same when using SQL_MODE=Oracle and when using FOR loops outside a stored procedure, like this:
MARIADB> delimiter //
|
MARIADB> BEGIN NOT ATOMIC |
DECLARE i INTEGER; |
FOR i IN 1..cnt() DO |
SELECT i; |
END FOR; |
END; |
//
|
ERROR 2006 (HY000): MySQL server has gone away
|
No connection. Trying to reconnect... |
Connection id: 4 |
Current database: test |
|
+---+ |
| i |
|
+---+ |
| 1 |
|
+---+ |
1 row in set (0.014 sec) |
|
ERROR 2013 (HY000): Lost connection to MySQL server during query |
Attachments
Issue Links
- is duplicated by
-
MDEV-32850 MariaDB got crash when call procedure
- Closed
- relates to
-
MDEV-23902 MariaDB crash on calling function
- Closed
-
MDEV-33702 crash in SP -> Trigger -> SUM aggregate + UDF?
- Open