{"id":671,"date":"2017-11-10T14:13:03","date_gmt":"2017-11-10T14:13:03","guid":{"rendered":"https:\/\/www.muratyaman.co.uk\/wp\/?p=671"},"modified":"2020-04-01T11:26:52","modified_gmt":"2020-04-01T10:26:52","slug":"mysql-error-thread-stack-overrun","status":"publish","type":"post","link":"https:\/\/www.muratyaman.co.uk\/blog\/index.php\/2017\/11\/mysql-error-thread-stack-overrun\/","title":{"rendered":"MySQL Error: Thread stack overrun"},"content":{"rendered":"<p>Recently, I&#8217;ve come across this error:<\/p>\n<blockquote><p>\nMySQL error 1436: Thread stack overrun:<br \/>\n164720 bytes used of a 196608 byte stack, and 32000 bytes needed.<br \/>\nUse &#8216;mysqld &#8211;thread_stack=#&#8217; to specify a bigger stack.\n<\/p><\/blockquote>\n<p>I am using PHP 7.0 and MySQL 5.7 on a Ubuntu 16.04 VM. Basically, I was dynamically creating more than 5 long SQL select commands and executing them.<\/p>\n<p>I&#8217;ve found some more information on MySQL&#8217;s website:<br \/>\n<a href=\"https:\/\/dev.mysql.com\/doc\/refman\/5.7\/en\/connection-threads.html\">Connection threads<\/a><\/p>\n<p>As a summary, they say:<\/p>\n<blockquote><p>\nWhen the thread stack is too small, this limits the complexity of the SQL statements which the server can handle, the recursion depth of stored procedures, and other memory-consuming actions.\n<\/p><\/blockquote>\n<p>So, I&#8217;ve edited the configuration file:<\/p>\n<p><code><br \/>\n\/etc\/mysql\/mysql.conf.d\/mysqld.conf<br \/>\n<\/code><\/p>\n<p>Changed the entry for thread_stack from 192k to 512k:<\/p>\n<p><code><br \/>\nthread_stack = 512k<br \/>\n<\/code><\/p>\n<p>256k was not enough in my case.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Recently, I&#8217;ve come across this error &#8230;<\/p>\n","protected":false},"author":2,"featured_media":678,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[57],"class_list":["post-671","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technology","tag-mysql"],"_links":{"self":[{"href":"https:\/\/www.muratyaman.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/posts\/671","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.muratyaman.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.muratyaman.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.muratyaman.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.muratyaman.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=671"}],"version-history":[{"count":5,"href":"https:\/\/www.muratyaman.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/posts\/671\/revisions"}],"predecessor-version":[{"id":876,"href":"https:\/\/www.muratyaman.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/posts\/671\/revisions\/876"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.muratyaman.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/media\/678"}],"wp:attachment":[{"href":"https:\/\/www.muratyaman.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=671"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.muratyaman.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=671"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.muratyaman.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=671"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}