Re: ToolHelp thread count doesn't match debugger

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



"Chris Tacke, eMVP" <ctacke.at.opennetcf.dot.com> writes:

OK, yeah, it seems that's the case. I looked with Remote Process
Viewer and it agreed with ToolHelp, not with the debugger. Maybe the
debugger is only showing managed threads.

That's my assumption, which IMO, makes it pretty worthless.

What's odd is that when I start my app, at the first line in main,
there are 6 threads running; once it gets up and running there are
9-10. When I ran it a few days ago, while it was running there were
2-3 (I didn't check threads when the program started). I have no idea
what could cause that.

Not odd at all. The CLR runs threads to do things, plus many managed
objects spin up worker threads to do work without you explicitly asking for
a thread. 9-10 doesn't seem crazy to me for a large app, especially if it's
doing any async monitoring.

What I thought was odd was the first time I ran it, it had 2-3
threads, but the next time it had 9-10. Today, I suddenly realized
what I suspect is the difference: between the two runs, I had set the
registry key which makes .NET applications run in "debug mode" so I
can attach the Visual Studio debugger once it is running (that didn't
work, but that's another story).

Now what's interesting is that since I have set that flag, my app has
been more stable than it's ever been. Before setting the flag, after
a few days of running, the network on the device will often cease to
function properly with no explanation; just DNS won't work anymore
until I reset the device, or at least disable/enable the interface.
Since I set that flag that hasn't happened. Very odd. If anybody has
suggestions of what that could mean, I'd appreciate it.

I haven't used Kernel Tracker before, looks like it's part of Platform
Builder. I'm working on a consumer SmartPhone device, is it still
possible to use it?

It's also part of eVC, which is a much smaller download and footprint.
Should work fine with your device, though you'll have to use platman, not
corecon, for connectivity.

Thanks, I haven't looked at this yet, but I will next time I dig into
this problem.

----Scott.
.



Relevant Pages

  • Re: ToolHelp thread count doesnt match debugger
    ... Viewer and it agreed with ToolHelp, not with the debugger. ... debugger is only showing managed threads. ... Not odd at all. ... Now what's interesting is that since I have set that flag, ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: ToolHelp thread count doesnt match debugger
    ... Viewer and it agreed with ToolHelp, not with the debugger. ... debugger is only showing managed threads. ... I'm working on a consumer SmartPhone device, ... Chris Tacke, Embedded MVP ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: [ptrace] please review follow fork/exec changes
    ... The SIGHUP I mentioned is due to the fact that the parent exits immediately. ... I think it will be easier if the flag is different from PL_FLAG_FORKED. ... PT_FOLLOW_EXEC is easy to implement, but my question is, how can debugger ... ignores the notification when the invalidation shall be done, ...
    (freebsd-current)
  • Re: EXCEPTION_INVALID_HANDLE woes
    ... The Flag is set in a registry key by tools such as gflags.exe. ... >> for the curent process or system wide, or if there is a debugger attached ... > exception is being reported by our customers, who I assume are not running ...
    (microsoft.public.win32.programmer.kernel)
  • [RFC PATCH] New SA_NOPRNOTIF sigaction flag
    ... Sometimes when a task is being ptraced (e.g. by a debugger), ... The SIGSEGV ... I'm proposing the addition of a new SA_NOPRNOTIF flag to struct sigaction ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)