{"id":108944,"date":"2023-10-31T07:00:00","date_gmt":"2023-10-31T14:00:00","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/oldnewthing\/?p=108944"},"modified":"2023-10-31T08:52:58","modified_gmt":"2023-10-31T15:52:58","slug":"20231031-00","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20231031-00\/?p=108944","title":{"rendered":"What is the thread reaper?"},"content":{"rendered":"<p>Buried in the long list of Windows bug check codes is <a title=\"Bug Check 0x13: EMPTY_THREAD_REAPER_LIST\" href=\"https:\/\/learn.microsoft.com\/en-us\/windows-hardware\/drivers\/debugger\/bug-check-0x13--empty-thread-reaper-list\"> this guy<\/a>:<\/p>\n<blockquote class=\"q\">\n<p><b>Bug Check 0x13: EMPTY_THREAD_REAPER_LIST<\/b><\/p>\n<p>The EMPTY_THREAD_REAPER_LIST bug check has a value of 0x00000013.<\/p>\n<p>This bug check appears very infrequently.<\/p>\n<\/blockquote>\n<p>That&#8217;s all it says.<\/p>\n<p>What is the origin story of this bug check code?<\/p>\n<p>Friend of the blog <a href=\"http:\/\/www.malsmith.net\/\"> Malcolm Smith<\/a> explained to me that this bug check code was introduced early in the development of Windows NT, and it may even have been used in some beta builds, but no released version of Windows NT ever used it. Nevertheless, the number was assigned, and you don&#8217;t want to reuse an assigned number, because that creates confusion if somebody running a beta build encounters bug check <code>0x00000013<\/code> and the bug gets sent to whatever component got the reassigned bug check code. These numbers don&#8217;t take up any space, and there are four billion of them, so losing one to history is no big deal.<\/p>\n<p>Okay, so this bug check code is no longer used. But just out of curiosity, what is a thread reaper anyway?<\/p>\n<p>In the Windows kernel, objects are generally responsible for destroying themselves. This doesn&#8217;t pose a problem for most categories of objects. But threads are a little stuck: Threads can destroy themselves for the most part, but the thing they can&#8217;t destroy is their own stack, because they&#8217;re <i>executing<\/i> on that stack.<\/p>\n<p>Therefore, when a thread terminates and cleans itself up, it cleans up everything it can, and then just before dying, it notifies the <i>thread reaper<\/i> to harvest its carcass: The thread reaper is a component whose sole purpose is to free the stacks of expired threads.<\/p>\n<p>My guess is that <code>EMPTY_<wbr \/>THREAD_<wbr \/>REAPER_<wbr \/>LIST<\/code> originally meant that the thread reaper was told to reap a thread, but there was no thread to reap.<\/p>\n<p>The thread reaper must have been redesigned in a way that this error can no longer occur (or at least if the list is empty, it&#8217;s not an error any more), and this bug check code is never generated. The code number has a name, but no purpose aside from hanging around in the documentation and tickling the curiosity of people who stumble across it.<\/p>\n<p><b>Bonus chatter<\/b>: Andrew Richards took the time to query the Windows Error Reporting database to see whether any systems had encountered this mythical <code>EMPTY_<wbr \/>THREAD_<wbr \/>REAPER_<wbr \/>LIST<\/code> bug check code in the past 30 days.\u00b9 And to his surprise, he found one!<\/p>\n<p>But upon closer inspection, it was a false alarm. The bug check was really <code>0x113<\/code>, also known as <a href=\"https:\/\/learn.microsoft.com\/en-us\/windows-hardware\/drivers\/debugger\/bug-check-0x113---video-dxgkrnl-fatal-error\"> <code>VIDEO_<wbr \/>DXGKRNL_<wbr \/>FATAL_<wbr \/>ERROR<\/code><\/a>, but there was a memory failure on the system, and a bit flip changed <code>0x00000113<\/code> into <code>0x00000013<\/code>.<\/p>\n<p><b>Bonus chatter<\/b>: There are many web sites and videos purporting to help you fix <code>EMPTY_<wbr \/>THREAD_<wbr \/>REAPER_<wbr \/>LIST<\/code> crashes. They make up reasons for why this error could occur (&#8220;not enough free disk space&#8221;, &#8220;incompatible device drivers&#8221;, &#8220;you installed EMPTY_<wbr \/>THREAD_<wbr \/>REAPER_<wbr \/>LIST-related software&#8221;) and make up troubleshooting steps (&#8220;restart in safe mode&#8221;, &#8220;update drivers&#8221;, and the ever-present &#8220;run sfc \/scannow&#8221;). Welcome to the world of auto-generated content farming.<\/p>\n<p>\u00b9 Windows Error Reporting crash dumps are retained for only 30 days, in order to comply with various governmental regulations.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Should you fear the thread reaper?<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[2],"class_list":["post-108944","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-history"],"acf":[],"blog_post_summary":"<p>Should you fear the thread reaper?<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/108944","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=108944"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/108944\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=108944"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=108944"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=108944"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}