<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>183 : Comp::Impl::WinNT</title><link>http://blogs.msdn.com/brettsh/archive/tags/Comp_3A003A00_Impl_3A003A00_WinNT/default.aspx</link><description>Tags: Comp::Impl::WinNT</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>thread degraded mode ... the sequel.</title><link>http://blogs.msdn.com/brettsh/archive/2006/03/19/554740.aspx</link><pubDate>Sun, 19 Mar 2006 12:08:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:554740</guid><dc:creator>BrettSh</dc:creator><slash:comments>23</slash:comments><comments>http://blogs.msdn.com/brettsh/comments/554740.aspx</comments><wfw:commentRss>http://blogs.msdn.com/brettsh/commentrss.aspx?PostID=554740</wfw:commentRss><description>&lt;font face="Verdana"&gt;I've run in &lt;a HREF="/brettsh/archive/2006/03/16/553388.aspx"&gt;thread degraded mode&lt;/a&gt; for 2 or 3 weeks
without a hitch before, this time I wasn't so lucky.&amp;nbsp; After about
6 hours explorer spun up taking 50% CPU (given it's a HT machine, that
usually means 1 thread spinning endlessly).&amp;nbsp; Heuve!&amp;nbsp; That
just won't do.&amp;nbsp; But we can merely degrade this thread too ... once we
find it ...&lt;br&gt;
&lt;br&gt;
So I ctrl-C in the debugger window that got started from &lt;a HREF="/brettsh/archive/2006/03/16/553388.aspx"&gt;part 1&lt;/a&gt; ...&lt;br&gt;&lt;/font&gt;
&lt;blockquote&gt;&lt;font face="Verdana"&gt;
Alternatively: If you don't have debugger attached up to the process yet,
you can do so, by going to the C:\debuggers directory (expained in &lt;a HREF="/brettsh/archive/2006/03/16/553388.aspx"&gt;part 1&lt;/a&gt;), typing "tlist" to
find the Process ID (PID) of the explorer.exe process, and then run "ntsd
-p &amp;lt;PID&amp;gt;".&lt;/font&gt;&lt;br&gt;
&lt;/blockquote&gt;
&lt;font face="Verdana"&gt;
At the debug prompt we type "!runaway", which gives you something like this:&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; 0:076&amp;gt; !runaway&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; User Mode Time&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; Thread&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Time&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; 73:1acc&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 days 6:36:51.328&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; 1:ec0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 days 1:39:27.203&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; 15:1ac&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 days 0:06:01.640&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; 12:f94&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 days 0:05:44.281&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; ... deleted the other ~80 threads ...&lt;br&gt;
The time column is cumulative CPU time the thread has used.&lt;br&gt;
&lt;br&gt;
At this point you 'g' the debugger, wait for a short timed interval,
then hit ctrl-C again to re-break into the debugger.&amp;nbsp; I waited 30
seconds myself, and then re-run the !runaway command ...&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; 0:082&amp;gt; !runaway&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; User Mode Time&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; Thread&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Time&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &lt;font color="#ff0000"&gt;&lt;b&gt;73&lt;/b&gt;&lt;/font&gt;:1acc&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 days 6:3&lt;font color="#0000ff"&gt;&lt;b&gt;7:21&lt;/b&gt;&lt;/font&gt;.359&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; 1:ec0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 days 1:39:28.406&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; 15:1ac&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 days 0:06:01.671&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; 12:f94&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 days 0:05:44.281&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;br&gt;
You can see from the &lt;font color="#0000ff"&gt;&lt;b&gt;blue&lt;/b&gt;&lt;/font&gt; that
thread 73 is our culprit, as it's cumulative CPU time went up by nearly
exactly 30 seconds.&amp;nbsp; Note the culprit thread isn't guaranteed to
be the top thread, but it was in my case.&lt;br&gt;
&lt;br&gt;
So the "~f" command from the first blog affects the "current" thread in
the debugger, which you can see above is thread 82, not exactly, well
... not at all what is desired.&amp;nbsp; We want thread 73 to be frozen
though, so here is how you freeze a specific thread:&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; 0:082&amp;gt; &lt;font color="#000000"&gt;~&lt;font color="#ff0000"&gt;&lt;b&gt;73&lt;/b&gt;&lt;/font&gt;f&lt;/font&gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; 0:082&amp;gt; g&lt;br&gt;
Now I'm back to normal, CPU settles down, go back to work.&lt;br&gt;
&lt;br&gt;Sometime later the next thing is I AV'd when I typed a search in the MSN Desktop
Search box on the task bar &lt;a href="http://brett.shirley.name/blog/imgsrc/blog2_taskband.jpg"&gt;see the bottom of my start bar&lt;/a&gt; ... since MSN DS was the source of the
original issue, &lt;/font&gt;&lt;font face="Verdana"&gt;not sure
why I'd have expected that to work (I can be really stupid sometimes, I'll blog more about that)&lt;/font&gt;&lt;font face="Verdana"&gt;, one more thread to freeze and
then 'g' the process.&lt;br&gt;
&lt;br&gt;
The last thing that AV'd is &amp;lt;window&amp;gt;-E.&amp;nbsp; Don't know why that AV'd, but don't care I can live without file explorer.&lt;br&gt;
&lt;br&gt;
Though I am not sure I can live without desktop search ... I sense a reboot is in my future ...&lt;br&gt;
&lt;br&gt;
&lt;/font&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=554740" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/brettsh/archive/tags/Comp_3A003A002A00_/default.aspx">Comp::*</category><category domain="http://blogs.msdn.com/brettsh/archive/tags/Comp_3A003A00_Impl_3A003A002A00_/default.aspx">Comp::Impl::*</category><category domain="http://blogs.msdn.com/brettsh/archive/tags/Comp_3A003A00_Impl_3A003A00_WinNT/default.aspx">Comp::Impl::WinNT</category></item><item><title>Try explorer's thread degraded mode ...</title><link>http://blogs.msdn.com/brettsh/archive/2006/03/16/553388.aspx</link><pubDate>Fri, 17 Mar 2006 04:29:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:553388</guid><dc:creator>BrettSh</dc:creator><slash:comments>61</slash:comments><comments>http://blogs.msdn.com/brettsh/comments/553388.aspx</comments><wfw:commentRss>http://blogs.msdn.com/brettsh/commentrss.aspx?PostID=553388</wfw:commentRss><description>&lt;font face="Verdana"&gt;On any given day that is past say 7 days of uptime, I have 100 - 300 windows open, not kidding, here is a shot of &lt;a href="http://brett.shirley.name/blog/imgsrc/blog2_taskband.jpg"&gt;my current task bar&lt;/a&gt;
... there shouldn't be anything msft confidential there, at least that
you'd actually be able to read more than 4 or 5 letters of ... I know
by heart I have 41 rows, so that's 204 windows open there ... I turn
off that "group similar taskbar buttons" "feature", and the buttons show
up in order, so a given "job" usually has task buttons around each
other (in fact the last 6 buttons there are for this blog post) ... so what
does this have to do with explorer ... &lt;br&gt;
&lt;br&gt;
The basic upshot of this computing lifestyle choice is that my heart
skips a beat and then visceral pain sets in whenever explorer AVs
(Access Violation) ... explorer is what controls the start bar, and
when it restarts the task buttons will be in a random order ... for the
*nix types, this is like your window manager core dumping ... it's
awefulness.&lt;br&gt;
&lt;br&gt;
Right so getting to thread degraded mode ... my own term, for when you
simply freeze the AV'd thread in a process, and allow the process to
continue on its merry way.&amp;nbsp; You
can do this because maybe the thread may not be doing something
particularly useful, ergo it is "not a very serious AV", or maybe call
it a "slight AV".&amp;nbsp; The process often (sometimes?) continues to
function.&lt;br&gt;
&lt;br&gt;
How to use thread degraded mode:&lt;br&gt;
&lt;br&gt;
First, you will have to prepare your machine for initiating thread degraded mode ...&lt;br&gt;
&lt;br&gt;
You will need to get a user mode debugger (there may already be a
ntsd.exe in your system32, which should work, but no one uses that anchient one) go get a
&lt;a href="http://www.microsoft.com/whdc/devtools/debugging/default.mspx"&gt;good version&lt;/a&gt;, which for an x86 box installs from this &lt;a href="http://msdl.microsoft.com/download/symbols/debuggers/dbg_x86_6.6.03.5.exe"&gt;exe&lt;/a&gt; (i think).&amp;nbsp; Install it
to C:\debuggers, everyone &lt;a HREF="/larryosterman/archive/2006/03/01/541403.aspx"&gt;else&lt;/a&gt; around here seems to.&lt;br&gt;&lt;br&gt;
Navigate to this registry key (&lt;a href="http://support.microsoft.com/default.aspx?scid=kb;en-us;103861&amp;amp;sd=tech"&gt;read more about it&lt;/a&gt;):&lt;br&gt;
"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug"&lt;br&gt;
Create registry string (REG_SZ) value with a name of "Debugger" and value of&lt;br&gt;
"C:\debuggers\ntsd -p %ld -g -G -e %ld"&lt;br&gt;
If it already has a value you may want to save it.&lt;br&gt;&lt;br&gt;
You only have to do those steps once, and now you are ready to run in thread degraded mode, if the need should arise.&lt;br&gt;
&lt;br&gt;
The next time explorer (or any application) crashes / AVs on you, you
will get an option to debug the process ... select "Debug" or "Yes" or
whatever ... this will open a debugger attached to explorer ( you'll
probably have to alt-tab to find this new debugger window, because the
task bar will be frozen/unresponsive while you debug it ;).&lt;br&gt;
&lt;br&gt;
The debugger will open with the AV'ing thread as the current thread, so
use "~f&amp;lt;enter&amp;gt;" (that is a tilde), to freeze this thread.&amp;nbsp;
Then "g&amp;lt;enter&amp;gt;" will let the task bar come back to you
(maybe).&amp;nbsp; At this point you should be praying that the thread you
froze isn't holding any crucial critical sections or locks, and that
things will return to "normal" ... your mileage may vary ... greatly.&lt;br&gt;
&lt;br&gt;It will look like this:&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0:008&amp;gt; ~f&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0:008&amp;gt; g&lt;br&gt;
&lt;br&gt;
After you 'g' it, it will start printing this kind of thing in the debugger ...&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; System 0: 1 of 84 threads are frozen&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; System 0: 1 of 84 threads were frozen&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; System 0: 1 of 84 threads are frozen&lt;br&gt;
That's just explorer letting you know it loves you for not letting go, and putting it on life support.&lt;br&gt;
&lt;br&gt;
Oh the crash was in MSN Desktop Search, but I don't fault (intended ;)
them because I'm running the first beta of the software released in Dec
2004, I've heard they've had an update since then.&lt;br&gt;
&lt;br&gt;
Anyway, as of approximately 8:20 AM (PST) yesterday (wed) morning, I've been
running in thread degraded mode ... as I finish this post I've got 4
frozen threads ... there were a few more threads with "issues" but I don't
have time to blog about them right yet ...&lt;br&gt;
&lt;br&gt;
&lt;/font&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=553388" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/brettsh/archive/tags/_2A003A003A00_So+fetch/default.aspx">*::So fetch</category><category domain="http://blogs.msdn.com/brettsh/archive/tags/Comp_3A003A002A00_/default.aspx">Comp::*</category><category domain="http://blogs.msdn.com/brettsh/archive/tags/Comp_3A003A00_Impl_3A003A002A00_/default.aspx">Comp::Impl::*</category><category domain="http://blogs.msdn.com/brettsh/archive/tags/Comp_3A003A00_Impl_3A003A00_WinNT/default.aspx">Comp::Impl::WinNT</category></item></channel></rss>