0

We are using MDBG to attach to IIS worker processes.

After performing stack snapshots, we detach with MDBgProcess.Detach().

While this call normally takes 10-80ms, occassionally it hangs for a very long time, also freezing the process in the meantime.

This is unacceptable since the process is a production program.

Here is our complete code:

try
{
    proc.AsyncStop();
}
finally
{
    // Make sure we are able to detach
    try
    {
        // delete all breakpoints
        proc.Breakpoints.DeleteAll();
    }
    catch (Exception e){}
    finally
    {
        // detach and wait
        var waitHandle = proc.Detach();
        if (proc.CanExecute())
        {
            waitHandle.WaitOne();
        }
    }
}

Any ideas why this may happen, and what we can do about it?

Best, Mike

ionwarp
  • 215
  • 1
  • 10

1 Answers1

0

I don't know why it would hang up, but I think you potentially have a race condition - in my program, I block until the process is stopped using the WaitOne() on the Stop()...

proc.AsyncStop().WaitOne();
m_Debugger.Processes.Active.Breakpoints.DeleteAll();
proc.CorProcess.Detach(); // I don't wait here because this is where my prog ends
Brian Donahue
  • 216
  • 1
  • 3