{"id":4838,"date":"2017-12-05T11:31:44","date_gmt":"2017-12-05T19:31:44","guid":{"rendered":"http:\/\/3.209.169.194\/blogs\/paul\/?p=4838"},"modified":"2020-01-20T13:30:06","modified_gmt":"2020-01-20T21:30:06","slug":"20122014-bug-that-can-cause-database-or-server-to-go-offline","status":"publish","type":"post","link":"https:\/\/www.sqlskills.com\/blogs\/paul\/20122014-bug-that-can-cause-database-or-server-to-go-offline\/","title":{"rendered":"Bug: database\/server &#8216;shutdown due to error 3314&#8217;"},"content":{"rendered":"<p style=\"text-align: justify;\">[Edit 3\/12\/2019: it looks like this bug, or a similar one, is also in SQL Server 2016. I&#8217;ll post an update once I have it.]<\/p>\n<p style=\"text-align: justify;\">[Edit 1\/20\/2020: still in 2016 SP2 CU8 as of today.]<\/p>\n<p style=\"text-align: justify;\">Over the years I&#8217;ve\u00a0discussed\u00a0<em>log space reservation<\/em>, which is when SQL Server automatically reserves some free space in the transaction log so that in-flight transactions can always be rolled back without the log having to grow. This is because rolling back a transaction requires generating more log records, and so there needs to be guaranteed space for them. If this did not happen, the log could fill up, in-flight transactions would begin to roll back, a log grow attempt might fail, and the database then goes suspect or into recovery because the in-flight transactions are essentially stuck.<\/p>\n<p style=\"text-align: justify;\">The algorithm is pretty conservative, and I fixed a few bugs in it before SQL Server 2005 shipped.<\/p>\n<p style=\"text-align: justify;\">There hasn&#8217;t been a case of it failing to reserve enough space until SQL Server 2012, when a bug was introduced. That bug was discovered by someone I was working with in 2015 (which shows just how rare the circumstances are), and at the time it was thought that the bug was confined to the log of\u00a0<em>tempdb<\/em> filling up, rollback failing, and the server shutting down.<\/p>\n<p style=\"text-align: justify;\">However, just last week I was contacted by someone running SQL Server 2012 SP3 who&#8217;d seen similar symptoms but for a user database this time, and the user database went into recovery. An example of the error log messages is below (altered for anonymity):<\/p>\n<pre class=\"brush: plain; gutter: false; title: ; toolbar: true; wrap-lines: true; notranslate\" title=\"\">\r\nDuring under of a logged operation in database 'mydb', an error occurred at log record ID (2445:89001:23). Typically, the specific failure is logged previously as an error in the Windows Event Log service. Restore the database or file from a backup, or repair the database.\r\nThe log for database 'mydb' is not available. Check the event log for related error messages. Resolve any errors and restart the database.\r\nError during rollback, shutting down database (location: 1)\r\nDatabase mydb was shutdown due to error 3314 in routine 'XdesRMReadWrite::RollbackToLsn'. Restart for non-snapshot databases will be attempted after all connections to the database are aborted.\r\nThe transaction log for database 'mydb' is full due to 'ACTIVE_TRANSACTION'.\r\nThe transaction log for database 'mydb' is full due to 'ACTIVE_TRANSACTION'.\r\nThe transaction log for database 'mydb' is full due to 'ACTIVE_TRANSACTION'.\r\n'D:\\Logs\\mydb.ldf: Operating system error 112(There is not enough space on the disk.) encountered.\r\n<\/pre>\n<p style=\"text-align: justify;\">I suggested that they&#8217;d hit the known bug, and they confirmed that with Microsoft.<\/p>\n<p style=\"text-align: justify;\">And if you hit it for <em>tempdb<\/em>, the server will shut down, as <em>tempdb<\/em> being unavailable means SQL Server has no choice but to stop.<\/p>\n<p style=\"text-align: justify;\">The bug is described in <a href=\"https:\/\/support.microsoft.com\/en-us\/help\/2963384\/fix-sql-server-crashes-when-the-log-file-of-tempdb-database-is-full-in\" target=\"_blank\" rel=\"noopener noreferrer\">KB article 2963384<\/a> and is included in SQL Server 2012 SP4 and SQL Server 2014 SP1.\u00a0If you&#8217;re running 2012 SP3\u00a0then you should install SP4, and if you&#8217;re running 2014 RTM then you should install the latest 2014 SP.<\/p>\n<p style=\"text-align: justify;\">I didn&#8217;t blog about the bug back in 2015 as only one person had hit it and the circumstances seemed incredibly rare, but now that seems to not be the case.<\/p>\n<p style=\"text-align: justify;\">Stay safe out there!<\/p>\n<p style=\"text-align: justify;\">\n","protected":false},"excerpt":{"rendered":"<p>[Edit 3\/12\/2019: it looks like this bug, or a similar one, is also in SQL Server 2016. I&#8217;ll post an update once I have it.] [Edit 1\/20\/2020: still in 2016 SP2 CU8 as of today.] Over the years I&#8217;ve\u00a0discussed\u00a0log space reservation, which is when SQL Server automatically reserves some free space in the transaction log [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19,98],"tags":[],"class_list":["post-4838","post","type-post","status-publish","format-standard","hentry","category-bugfixes","category-transaction-log"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Bug: database\/server &#039;shutdown due to error 3314&#039; - Paul S. Randal<\/title>\n<meta name=\"description\" content=\"SQL Server bug: database\/server &#039;shutdown due to error 3314&#039;\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.sqlskills.com\/blogs\/paul\/20122014-bug-that-can-cause-database-or-server-to-go-offline\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Bug: database\/server &#039;shutdown due to error 3314&#039; - Paul S. Randal\" \/>\n<meta property=\"og:description\" content=\"SQL Server bug: database\/server &#039;shutdown due to error 3314&#039;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.sqlskills.com\/blogs\/paul\/20122014-bug-that-can-cause-database-or-server-to-go-offline\/\" \/>\n<meta property=\"og:site_name\" content=\"Paul S. Randal\" \/>\n<meta property=\"article:published_time\" content=\"2017-12-05T19:31:44+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-01-20T21:30:06+00:00\" \/>\n<meta name=\"author\" content=\"Paul Randal\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Paul Randal\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/20122014-bug-that-can-cause-database-or-server-to-go-offline\/\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/20122014-bug-that-can-cause-database-or-server-to-go-offline\/\",\"name\":\"Bug: database\/server 'shutdown due to error 3314' - Paul S. Randal\",\"isPartOf\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#website\"},\"datePublished\":\"2017-12-05T19:31:44+00:00\",\"dateModified\":\"2020-01-20T21:30:06+00:00\",\"author\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/ffcec826c18782e1e0adf173826a7fce\"},\"description\":\"SQL Server bug: database\/server 'shutdown due to error 3314'\",\"breadcrumb\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/20122014-bug-that-can-cause-database-or-server-to-go-offline\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.sqlskills.com\/blogs\/paul\/20122014-bug-that-can-cause-database-or-server-to-go-offline\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/20122014-bug-that-can-cause-database-or-server-to-go-offline\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Bug: database\/server &#8216;shutdown due to error 3314&#8217;\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#website\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/\",\"name\":\"Paul S. Randal\",\"description\":\"In Recovery...\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/ffcec826c18782e1e0adf173826a7fce\",\"name\":\"Paul Randal\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/0b6a266bba2f088f2551ef529293001bd73bf026bc1908b9866728c062beeeb6?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/0b6a266bba2f088f2551ef529293001bd73bf026bc1908b9866728c062beeeb6?s=96&d=mm&r=g\",\"caption\":\"Paul Randal\"},\"sameAs\":[\"http:\/\/3.209.169.194\/blogs\/paul\"],\"url\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/author\/paul\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Bug: database\/server 'shutdown due to error 3314' - Paul S. Randal","description":"SQL Server bug: database\/server 'shutdown due to error 3314'","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.sqlskills.com\/blogs\/paul\/20122014-bug-that-can-cause-database-or-server-to-go-offline\/","og_locale":"en_US","og_type":"article","og_title":"Bug: database\/server 'shutdown due to error 3314' - Paul S. Randal","og_description":"SQL Server bug: database\/server 'shutdown due to error 3314'","og_url":"https:\/\/www.sqlskills.com\/blogs\/paul\/20122014-bug-that-can-cause-database-or-server-to-go-offline\/","og_site_name":"Paul S. Randal","article_published_time":"2017-12-05T19:31:44+00:00","article_modified_time":"2020-01-20T21:30:06+00:00","author":"Paul Randal","twitter_misc":{"Written by":"Paul Randal","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/20122014-bug-that-can-cause-database-or-server-to-go-offline\/","url":"https:\/\/www.sqlskills.com\/blogs\/paul\/20122014-bug-that-can-cause-database-or-server-to-go-offline\/","name":"Bug: database\/server 'shutdown due to error 3314' - Paul S. Randal","isPartOf":{"@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#website"},"datePublished":"2017-12-05T19:31:44+00:00","dateModified":"2020-01-20T21:30:06+00:00","author":{"@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/ffcec826c18782e1e0adf173826a7fce"},"description":"SQL Server bug: database\/server 'shutdown due to error 3314'","breadcrumb":{"@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/20122014-bug-that-can-cause-database-or-server-to-go-offline\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.sqlskills.com\/blogs\/paul\/20122014-bug-that-can-cause-database-or-server-to-go-offline\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/20122014-bug-that-can-cause-database-or-server-to-go-offline\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.sqlskills.com\/blogs\/paul\/"},{"@type":"ListItem","position":2,"name":"Bug: database\/server &#8216;shutdown due to error 3314&#8217;"}]},{"@type":"WebSite","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#website","url":"https:\/\/www.sqlskills.com\/blogs\/paul\/","name":"Paul S. Randal","description":"In Recovery...","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.sqlskills.com\/blogs\/paul\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/ffcec826c18782e1e0adf173826a7fce","name":"Paul Randal","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/0b6a266bba2f088f2551ef529293001bd73bf026bc1908b9866728c062beeeb6?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/0b6a266bba2f088f2551ef529293001bd73bf026bc1908b9866728c062beeeb6?s=96&d=mm&r=g","caption":"Paul Randal"},"sameAs":["http:\/\/3.209.169.194\/blogs\/paul"],"url":"https:\/\/www.sqlskills.com\/blogs\/paul\/author\/paul\/"}]}},"_links":{"self":[{"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/posts\/4838","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/comments?post=4838"}],"version-history":[{"count":0,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/posts\/4838\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/media?parent=4838"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/categories?post=4838"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/tags?post=4838"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}