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.
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:
- Make sure you got your Windows Debuggers installed.
- 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.
-
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!
Juan Uribe
Hi Mike, I have been reading your posts for a while now. Grate by the way, very instructive.
We have a limited IT staff at Refinancia and one clear issue is that we don’t have anyone skilled at IIS. We basically have developers, and some windows server support, and DBA.
We have been trying to tackle down issues with our PHP/IIS application. Most errors are just bad SQL statements and BAD PHP code, which will take months or years to fix 🙁
We were relying entirely on logs left by the application in the DB. This offered us lot of insight and helped us identify lot of errors. Although we have done a lot of work we are still faced with lots of tickets where users complaining about http 500 errors.
I suggested that we start testing LeanSentry so that we can better monitor the IIS servers. Although we have been only using the “demo” version for a couple of days we now see a LOT MORE.
What’s very alarming is that now we see 1000’s of 500 errors not just what users where reporting.
Unfortunately seeing the errors and the LeanSentry diagnosis are still far from helping us understand what is causing them. I’m not sure if purchasing the standard, or professional will help, as we still lack a lot skills. I have also posted on iis.net forums (http://forums.iis.net/post/2103864.aspx) asking for advice with no replies.
Now no where else to ask I thought of asking you directly for advice. I don’t know LeanSentry with the other vesions will help us diagnose the issue (although we are planning on the standard version), or maybe how your company can better accompany us helping us find and fix issues with our deployment.
If you wish to talk my mobile number is +57(316)577-5919.
Thanks.
Juan Uribe
CTO Refinancia
Kary Lemonde
I was looking back on your article from way back on two level IIS auth (mixing forms and windows). Did you ever post your code somewhere else, the links are now broken…
http://mvolo.com/assets/pre-migration/twolevelauth_v1.zip
http://mvolo.com/assets/pre-migration/formsauthwrapper_source_v1.zip
I’m working on an ASP.NET MVC5 project and client wants to support AD users from their internal network to get a SSO type capability if they are already logged into the domain..your example is EXACTLY what i need, but i don’t see anywhere to grab your source code? Thoughts?
None
I’m also very interested in this