Debugging unknown termination of adplusmanager.exe – Windbg

With the latest release of debugging tools (6.12.0002.633) comes AdplusManager.exe  ,which is in managed code.  The adplusmanager.exe is a tool to manage multiple instance of adplus running across in different machines. Essentially a Master to control different slaves.  I will blog about the usage of this in a future post.

When I tried to start the AdplusManager.exe from the command line , nothing happened. My guess was if I didn’t enter any command line parameters , the tool should come up with the help text in the command line, similar to rest of command line tools I have used from MS. The next option I tried was  “AdplusManager.exe HELP” and there wasn’t any output. Surprisingly I went back to the documentation to look for command line parameters , which I never do, because I expect the tool to provide me with options. After reading the documentation for the parameters , the next option I tried was “D:\Program Files\Debugging Tools for Windows (x64)\adplusmanager.exe” GUI and nothing happened.  The only choice was to launch adplusmanager.exe using Windbg.

Because it was failing on the startup of the application ,I had set a load break-point when mscorwks was loaded in to the process , So that I can load sos after CLR is  loaded.

sxe -c ".loadby sos mscorwks;g" ld:mscorwks

And then setup a break-point on CLR exception , to dump the call stack and exception information

sxe -c "!clrstack;!pe" clr

And here is the output from the debugger

ModLoad: 000007fe`ef420000 000007fe`efdce000   C:\Windows\Microsoft.NET\Framework64\v2.0.50727\mscorwks.dll
(37760.36d40): CLR exception – code e0434f4d (first chance)
OS Thread Id: 0x36d40 (0)
*** WARNING: Unable to verify checksum for C:\Windows\assembly\NativeImages_v2.0.50727_64\mscorlib\9a017aa8d51322f18a40f414fa35872d\mscorlib.ni.dll
Child-SP         RetAddr          Call Site
000000000026e320 000007fee8f57b24 System.IO.__Error.WinIOError(Int32, System.String)
000000000026e380 000007fee8f570aa System.IO.FileStream.Init(System.String, System.IO.FileMode, System.IO.FileAccess, Int32, Boolean, System.IO.FileShare, Int32, System.IO.FileOptions, SECURITY_ATTRIBUTES, System.String, Boolean)
000000000026e510 000007fee8f587f2 System.IO.FileStream..ctor(System.String, System.IO.FileMode, System.IO.FileAccess, System.IO.FileShare, Int32, System.IO.FileOptions, System.String, Boolean)
000000000026e5a0 000007fee8f25b1b System.IO.FileStream..ctor(System.String, System.IO.FileMode, System.IO.FileAccess, System.IO.FileShare, Int32, System.IO.FileOptions)
000000000026e630 000007fee95fdefa System.IO.StreamWriter..ctor(System.String, Boolean, System.Text.Encoding, Int32)
000000000026e6b0 000007ff001a1653 System.IO.StreamWriter..ctor(System.String)
000000000026e700 000007ff001a15d4 ADPlusManager.Logger.Open(System.String)
000000000026e740 000007ff001a036d ADPlusManager.Logger.Open(System.String, System.String)
000000000026e7b0 000007feef6ed502 ADPlusManager.Program.Main(System.String[])
Exception object: 0000000002599e50
Exception type: System.IO.DirectoryNotFoundException
Message: Could not find a part of the path ‘c:\logs\AdplusManager_20100308_195722_NAVEEN-PC_GUI.log’.
InnerException: <none>
StackTrace (generated):
<none>
StackTraceString: <none>
HResult: 80070003
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
KERNELBASE!RaiseException+0x39:
000007fe`fd05aa7d 4881c4c8000000  add     rsp,0C8h

And the exception is DirectoryNotFoundException because I don’t have C:\logs directory.  The next step was to disassemble the code and Why am I not surprised to see something

Within the exception handler the code is invoking ErrorOutput method

and the ErrorOutput method is trying to Log it to the disk  that’s the reason it blew up. I would imagine that Microsoft would have a caught this bug and addressed it.

Takeaway

Make sure the code within catch block does not throw an exception.

About Naveen
Write code.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: