Quantcast
Channel: ASP.NET Archives - Mike Volodarsky's Blog
Viewing all articles
Browse latest Browse all 20

When CPU profiling goes bad in production

0
0

This week’s Leansentry How-To article covers a tricky topic: how to recover from a failed CPU profiler that has frozen your process in production.

Process hung by a CPU profiler

Recovering from a CPU profiling failure

This is something I hope you don’t have to do often, but it pays to know if you ever get into this situation. I have personally had to do this twice with the ANTs Profiler last year.

More here: Recover production process hung by a CPU profiler.

This also talks about different ways that you can profile in production, and the associated risks.

Temporarily freezing a process

I thought I would add another tip, which is the opposite of what the How-To is about: a dirty trick to freeze a process that you don’t want running (at least for a while), without killing it:

  1. Make sure you got your Windows Debuggers installed.
  2. Run this command:

    ntsd -p PID -c "~*n;.detach;qq"



    This will suspend all threads in the process, essentially “suspending” it until you give the go ahead. This DOES NOT leave the debugger attached to the process, and is different from “freezing” a thread which is only effective while the debugger is attached.

  3. When ready, resume the process like this:

    ntsd -p PID -c "~*m;.detach;qq"


I don’t recommend this trick unless you need it, because it can lead to possible issues including the process maintaining exclusive locks on files or mutexes, as well as failures when the process resumes and encounters network timeouts/unexpected time values.

However, it’s definitely still safer than killing the process if you don’t want it to run at the moment (e.g. usually does not corrupt data).

Hope you find this how-to useful, as always feel free to leave your feedback here. Until next week!

The post When CPU profiling goes bad in production appeared first on Mike Volodarsky's Blog.


Viewing all articles
Browse latest Browse all 20

Latest Images

Trending Articles



Latest Images