Skip to content

Commit

Permalink
RavenDB-3960 Embedded dbghelp.dll (10.0.10586.0) to use with Raven.De…
Browse files Browse the repository at this point in the history
…bug.exe
  • Loading branch information
ppekrol committed Jan 28, 2016
1 parent aace05e commit ee78b74
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 24 deletions.
2 changes: 2 additions & 0 deletions Raven.Database/Raven.Database.csproj
Expand Up @@ -1205,6 +1205,8 @@
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Util\Raven.Debug\x64\dbghelp.dll" />
<EmbeddedResource Include="Util\Raven.Debug\x86\dbghelp.dll" />
<EmbeddedResource Include="Util\Raven.Debug\x86\Raven.Debug.exe" />
<EmbeddedResource Include="Util\Raven.Debug\x64\Raven.Debug.exe" />
<EmbeddedResource Include="Server\WebUI\raven-data.ico" />
Expand Down
58 changes: 34 additions & 24 deletions Raven.Database/Server/Controllers/Admin/AdminController.cs
Expand Up @@ -219,9 +219,9 @@ public async Task<HttpResponseMessage> Restore()
}
}
Database.Documents.Put(RestoreInProgress.RavenRestoreInProgressDocumentKey, null, RavenJObject.FromObject(new RestoreInProgress
{
Resource = databaseName
}), new RavenJObject(), null);
{
Resource = databaseName
}), new RavenJObject(), null);

DatabasesLandlord.SystemDatabase.Documents.Delete(RestoreStatus.RavenRestoreStatusDocumentKey, null, null);

Expand Down Expand Up @@ -271,7 +271,7 @@ public async Task<HttpResponseMessage> Restore()
DatabasesLandlord.SystemDatabase.Documents.Put(RestoreStatus.RavenRestoreStatusDocumentKey, null,
RavenJObject.FromObject(restoreStatus), new RavenJObject(), null);
if (restoreRequest.GenerateNewDatabaseId)
if (restoreRequest.GenerateNewDatabaseId)
GenerateNewDatabaseId(databaseName);
if (replicationBundleRemoved)
Expand Down Expand Up @@ -431,7 +431,7 @@ public HttpResponseMessage CheckConnectivityToLicenseServer()
try
{
request.Timeout = 5000;
using (var response = (HttpWebResponse) request.GetResponse())
using (var response = (HttpWebResponse)request.GetResponse())
{
return GetMessageWithObject(new { Success = response.StatusCode == HttpStatusCode.OK });
}
Expand Down Expand Up @@ -478,7 +478,7 @@ public HttpResponseMessage Compact()
{
bool skipProgressReport = false;
bool isProgressReport = false;
if(IsUpdateMessage(msg))
if (IsUpdateMessage(msg))
{
isProgressReport = true;
var now = SystemTime.UtcNow;
Expand All @@ -490,7 +490,7 @@ public HttpResponseMessage Compact()
compactStatus.LastProgressMessage = msg;
}
else skipProgressReport = true;
}
if (!skipProgressReport)
{
Expand Down Expand Up @@ -836,16 +836,16 @@ public HttpResponseMessage InfoPackage()
var response = new HttpResponseMessage();

response.Content = new StreamContent(new FileStream(tempFileName, FileMode.Open, FileAccess.Read))
{
Headers =
{
Headers =
{
ContentDisposition = new ContentDispositionHeaderValue("attachment")
{
FileName = string.Format("Admin-Debug-Info-{0}.zip", SystemTime.UtcNow),
},
ContentType = new MediaTypeHeaderValue("application/octet-stream")
}
};
};

return response;
}
Expand Down Expand Up @@ -873,12 +873,21 @@ private static void DumpStacktrace(ZipArchive package)

ravenDebugDir = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
var ravenDebugExe = Path.Combine(ravenDebugDir, "Raven.Debug.exe");
var ravenDbgHelp = Path.Combine(ravenDebugDir, "dbghelp.dll");
var ravenDebugOutput = Path.Combine(ravenDebugDir, "stacktraces.txt");

Directory.CreateDirectory(ravenDebugDir);

if (Environment.Is64BitProcess) ExtractResource("Raven.Database.Util.Raven.Debug.x64.Raven.Debug.exe", ravenDebugExe);
else ExtractResource("Raven.Database.Util.Raven.Debug.x86.Raven.Debug.exe", ravenDebugExe);
if (Environment.Is64BitProcess)
{
ExtractResource("Raven.Database.Util.Raven.Debug.x64.dbghelp.dll", ravenDbgHelp);
ExtractResource("Raven.Database.Util.Raven.Debug.x64.Raven.Debug.exe", ravenDebugExe);
}
else
{
ExtractResource("Raven.Database.Util.Raven.Debug.x86.dbghelp.dll", ravenDbgHelp);
ExtractResource("Raven.Database.Util.Raven.Debug.x86.Raven.Debug.exe", ravenDebugExe);
}

var process = new Process
{
Expand All @@ -895,7 +904,7 @@ private static void DumpStacktrace(ZipArchive package)
EnableRaisingEvents = true
};



process.OutputDataReceived += (sender, args) => output += args.Data;
process.ErrorDataReceived += (sender, args) => output += args.Data;
Expand Down Expand Up @@ -983,7 +992,7 @@ public HttpResponseMessage OnAdminLogsConfig()
}
return GetMessageWithObject(connectionState);
}

var watchCatogory = GetQueryStringValues("watch-category");
var categoriesToWatch = watchCatogory.Select(
x =>
Expand Down Expand Up @@ -1059,11 +1068,11 @@ public async Task<HttpResponseMessage> IoTest()
case BatchPerformanceTestRequest.Mode:
ioTestRequest = json.JsonDeserialization<BatchPerformanceTestRequest>();
break;
default:
default:
return GetMessageWithObject(new
{
Error = "test type is invalid: " + testType
}, HttpStatusCode.BadRequest);
{
Error = "test type is invalid: " + testType
}, HttpStatusCode.BadRequest);
}

Database.Documents.Delete(AbstractDiskPerformanceTester.PerformanceResultDocumentKey, null, null);
Expand Down Expand Up @@ -1128,20 +1137,21 @@ public HttpResponseMessage GetLowMemoryStatistics()
if (EnsureSystemDatabase() == false)
return GetMessageWithString("Low memory simulation is only possible from the system database", HttpStatusCode.BadRequest);

return GetMessageWithObject(MemoryStatistics.GetLowMemoryHandlersStatistics().GroupBy(x=>x.DatabaseName).Select(x=> new
return GetMessageWithObject(MemoryStatistics.GetLowMemoryHandlersStatistics().GroupBy(x => x.DatabaseName).Select(x => new
{
DatabaseName = x.Key,
Types = x.GroupBy(y=>y.Name).Select(y=> new
Types = x.GroupBy(y => y.Name).Select(y => new
{
MemoryHandlerName = y.Key,
MemoryHandlers = y.Select(z=> new {
z.EstimatedUsedMemory,
z.Metadata
MemoryHandlers = y.Select(z => new
{
z.EstimatedUsedMemory,
z.Metadata
})
})
}));


}
}
}
Binary file added Raven.Database/Util/Raven.Debug/x64/dbghelp.dll
Binary file not shown.
Binary file added Raven.Database/Util/Raven.Debug/x86/dbghelp.dll
Binary file not shown.

0 comments on commit ee78b74

Please sign in to comment.