Access Denied while trying to create mini-dump with WinDbg - c#

I am trying to create a mini-dump using WinDbg. After attaching to the process (non-invasive), I execute the following command:
.dump /mA c:\Temp\app.dmp
This results in the following error:
Creating c:\Temp\app.dmp - mini user dump
WriteFullMemory.Memory.Read(0xe730000, 0x10000) failed 0x8007012b, skip.
WriteFullMemory.QueryVirtual(0x0) for info failed, 0x80070005
Dump creation failed, Win32 error 0n5
    "Access is denied."
WinDdg is being run as an Administrator. We have the lastest version of WinDbg, we confirmed we're running the 64 bit version and the process being attached is 64 bit. Does anyone know how this can be resolved?
For context, we're taking the dump to isolate the root cause of a memory leak in one of our IIS-hosted WCF Web Services.
Side note: this may be due to paged memory but not sure how to get around that.

Related

RavenDB EsentOutOfLongValueIDsException

The following error is intermittently thrown when attempting to add or update a document: "Microsoft.Isam.Esent.Interop.EsentOutOfLongValueIDsException: Long-value ID counter has reached maximum value. (perform offline defrag to reclaim free/unused LongValueIDs)"
I've attempted to perform this offline defrag according to
https://ravendb.net/docs/article-page/3.5/csharp/users-issues/recovering-from-esent-errors. I stopped the RavenDB service, navigated to the Databases folder in Adminstator command prompt and ran "esentutl /d DatabaseName". I then get the following error:
"Access to source database 'DatabaseName' failed with Jet error -1032.
Operation terminated with wrror -1032 after 20.31 seconds."
I have also tried to restart the server with RavenDB not set to start on start-up. I still get error -1032 when attempting to defrag.
Is performing the defrag operation the correct action? If so, what process(es) would I need to stop in order for those files to not be in use?
Thanks!
The solution was to run compact on raven. Raven studio > Manage Your Server > Compact. Compacting takes the database down, so I performed it on the replicated servers one at a time.

C# COM application crash debugging

The C# console application running .NET 4.5.2 (app1) opens a COM application (app2) and does some work with that app2's API. So far all of the work is successful, but sometimes when app1 attempts to close app2, app2 hangs permanently.
If the process for app2 is ended with task manager then app1 reports access denied. Does that occur because the terminated process is no longer available or does it occur because it was blocking a thread in app1 and it was unable to report the error until the thread was allowed to continue?
The code used to terminate app2 is
private static void CloseSW(SldWorks swApp, Process sw_proces)
{
// Close with API call
if (Task.Run(() => { swApp.CloseAllDocuments(true); swApp.ExitApp(); }).Wait(TimeSpan.FromSeconds(20)))
return;
// Kill process if API call failed
if (Task.Run(() => { SWHelper.CloseSW(sw_proces); }).Wait(TimeSpan.FromSeconds(20)))
return;
// Unable to close SolidWorks, ignore error and continue
// This will eventually cause SolidWorks to crash and the crash handler will take over
}
This code should never take much more than 40 seconds to complete, but maybe the COM interop is causing some unexpected behaviour?
I am unable to reproduce this error on a development machine. What it the best way to trace the exact point of failure? It is possible that the failure is not in CloseSW but some point before this. Is there a better way to trace the error than to write each line to a log file?
It is also worth noting that this code works for 60 - 150 runs before it has any errors and both applications are closed between each run.
I have control of the remote environment so remote debugging is an option, but I've never set that up before.
Typically with COM interops causing issues is that IIS is having issues with the object using the current ISAPI.dll. Please verify that your permissions are configured within your assembly to work with your current version of IIS>
A few questions to help assist would be, which framework version are you using, which version of IIS and what is your Application Pool using for a framework.
HTH

Fusion Log Assembly Binder Error - Bind result: hr = 0x1. Incorrect function

I am trying to get to the bottom of a strange behavior on one machine. I have a trivial console application that will run interactively, but when I invoke it via WMI, it will start and exit immediately.
I enabled the Fusion log, since Procmon was unrevealing. I see the following error:
*** Assembly Binder Log Entry (31-01-2015 # 19:22:51) ***
The operation was successful.
Bind result: hr = 0x1. Incorrect function.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable C:\CMCBOOTSTRAP\Cmc.Installer.Agent.Console.exe
--- A detailed error log follows.
BEGIN : Native image bind.
END : Incorrect function. (Exception from HRESULT: 0x00000001 (S_FALSE))
What is the cause for "incorrect function"? What else can I look at to determine why this application effectively dies on startup via WMI?
And I mean trivial...
class Program
{
static void Main(string[] args)
{
Thread.Sleep(30000);
}
}
Environment is Windows Server 2012 R2 and .NET 4.5.
This is an entirely normal mishap, you got it from Fuslogvw.exe by selecting the "Native Images" radio button in the Log Categories setting. Readily reproducible on my own machine as well, I see many of them.
The actual error code is S_FALSE, a COM error code that means "it successfully failed". Which is why it says The operation was successful. Misinterpreted for the diagnostic message as "Function failed", that's the description for Windows error 1 and returned by the FormatMessage() winapi function.
The successful failure is entirely expected, you didn't run Ngen.exe on your console mode app yet so the native image for it is not available. Keep looking, this is not it. Change the Log Category back to "Default", native images are not your problem.
This error can also occur if you have a 64 bit dependency while your process or IIS runs on 32 bit.

DebugDiag not seeing exception

I am supporting an application team and they have an issue with their web page - the below is shown:
Retrieving the COM class factory for component with CLSID {0002E569-0000-0000-C000-000000000046} failed due to the following error: 80070005.
I have looked around here and other sites but cannot find the culprit of the access denied object. The object itself is registered in the registry as "Microsoft Office Spreadsheet 11.0".
I have decided to take a dump of the this whilst it happens so I can see where in the code the problem is occurring and possibly track down some info from there.
I have tried debugdiag and tried loads of exception settings however when I go to the website and raise the exception of System.UnauthorizedAccessException it is not saving any dump.
There is no default exception in the exception list called 80070005 so I am putting it down as a .NET 4.0 app and 80070005 - this is the Hex value of access denied as appears in the error message.
Any ideas what settings I should choose for debugdiag to see the exception?

C# SEHException when trying to access personal folder

Using C#, I'm getting a SEHEXception whenever I try to get the path to my personal folder via
Environment.GetFolderPath(Environment.SpecialFolder.Personal)
The detailed exception is:
System.Runtime.InteropServices.SEHException was unhandled
Message=External component has thrown an exception.
Source=mscorlib
ErrorCode=-2147467259
StackTrace:
at Microsoft.Win32.Win32Native.SHGetFolderPath(IntPtr hwndOwner, Int32 nFolder,
IntPtr hToken, Int32 dwFlags, StringBuilder lpszPath)
at System.Environment.GetFolderPath(SpecialFolder folder,
SpecialFolderOption option)
at System.Environment.GetFolderPath(SpecialFolder folder)
[...]
There's no InnerException.
Does anybody have an idea what's wrong? The problem does not occur when I try to get the system path, for example. I'm using Windows XP SP3 and Visual Studio 2010.
Also, I had a friend with vista and VS2005 try to do this on his machine and he doesn't get this Exception.
This is just a hunch, but by any chance are you running this code from an MTA thread?
I know that some Windows Shell API calls will fail if they are not running in STA. Truth be told, I have only ever encountered this problem when I was doing PInvoke stuff, but this call to the native SHGetFolderPath function in your stack trace tells me it just might be it.
So... to test my theory, can you try calling Environment.GetFolderPath(Environment.SpecialFolder.Personal) from Main in a simple console application and see if this call succeeds?
If it succeeds in a simple dummy application, then maybe MTA is the cause of failure in your app.
If it fails in a simple dummy application, your machine is probably messed up, or maybe just the user's profile. I would try creating a new user on the machine, logon to his account and try from there.
Edit:
Trying some more directions:
Look directly at HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders in Regedit and check if everything looks normal.
Check Event Viewer if other things are corrupted on the machine.
Restart the machine...? :)
Reinstall .NET Framework

Categories