MySQL Thread_stack Overrun Error
We added a trigger to MySQL (v5.5.28) recently that was a simple UPDATE on table column, when a target table was UPDATEd. It ran fine (as expected) on our development environment but not when we pushed the changes to staging.
The error being thrown by MySQL was:
Querying the database told me that the current thread_stack setting is 128K:
1 2 3 4 5 6 7
This was confirmed by looking at the thread_stack variable in /etc/mysql/my.cnf
The docs for MySQL 5.5 suggest that it should be 192K for 32-bit systems and 256K for 64-bit systems. We’re running a 64-bit platform, you can tell by running:
If the response is i686, you have a 32-bit version of Linux and if the response is x86_64 then you have a 64-bit version of Linux.
The fix is a simple case of increasing the value to 256K (if you’re on 64-bit) or 192K if you’re on 32-bit, as per the documentation. Don’t forget that the thread_stack is an allocation of memory per connection, so don’t set it too high or you might run into memory issues on your database server.
In case it wasn’t clear, you can make this change in your my.cnf file.