I'm just learning the stored-function and -procedure syntax for MySQL. I hard-coded a function that just returns the number 12, and it overflows the stack. Anybody know what's up here? This is MySQL 5.5.30.
mysql> DELIMITER //
mysql> CREATE FUNCTION `newItemID`()
-> RETURNS BIGINT
-> SQL SECURITY INVOKER
-> BEGIN
-> RETURN 12;
-> END;
-> //
Query OK, 0 rows affected (0.00 sec)
mysql> DELIMITER ;
mysql> SELECT newItemID();
ERROR 1436 (HY000): Thread stack overrun: 12288 bytes used of a 131072 byte stack, and 128000 bytes needed. Use 'mysqld --thread_stack=#' to specify a bigger stack.
like @wrikken pointed out this is a known bug when you're running a 128k thread stack, however it was fixed in newer versions of mysql and it was supposed to be fixed, so maybe you're running an older version or a non-official package.
It is reccommended to use a stack that has at least 192k on it, so you could go to your my-small.cnf and make my-innodb-heavy-4G.cnf:thread_stack = 192k
my-small.cnf:thread_stack = 128K
.
All of these remedies are available in the mysql bug report, but please test this offline before modifying your server. Make sure the offline localhost has the same settings and configurations just like your live server, that is if you're using a live server. Basically make an exact duplicate of your server and test it offline and if the fix works and doesn't cause any issues, put it online.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With