Collect dumps on VSTS (#1244)
This commit is contained in:
parent
6440545c4a
commit
24ed5586dc
|
|
@ -3,16 +3,26 @@ phases:
|
|||
parameters:
|
||||
agentOs: Windows
|
||||
beforeBuild:
|
||||
- powershell: "& ./tools/UpdateIISExpressCertificate.ps1; & ./tools/update_schema.ps1"
|
||||
- powershell: "& ./tools/UpdateIISExpressCertificate.ps1; & ./tools/update_schema.ps1; & ./tools/SetupTestEnvironment.ps1 Setup"
|
||||
displayName: Prepare repo
|
||||
afterBuild:
|
||||
- powershell: "& ./tools/SetupTestEnvironment.ps1 Shutdown"
|
||||
displayName: Stop AppVerifier
|
||||
condition: always()
|
||||
- task: PublishBuildArtifacts@1
|
||||
displayName: Upload binlog
|
||||
displayName: Upload logs
|
||||
condition: eq(variables['system.pullrequest.isfork'], false)
|
||||
inputs:
|
||||
artifactName: logs
|
||||
artifactType: Container
|
||||
pathtoPublish: artifacts/logs/
|
||||
pathtoPublish: artifacts/logs
|
||||
- task: PublishBuildArtifacts@1
|
||||
displayName: Upload dumps
|
||||
condition: eq(variables['system.pullrequest.isfork'], false)
|
||||
inputs:
|
||||
artifactName: dumps
|
||||
artifactType: Container
|
||||
pathtoPublish: artifacts/dumps
|
||||
|
||||
- template: .vsts-pipelines/templates/phases/default-build.yml@buildtools
|
||||
parameters:
|
||||
|
|
|
|||
|
|
@ -0,0 +1,96 @@
|
|||
param($Mode)
|
||||
|
||||
function Setup-appverif($application)
|
||||
{
|
||||
appverif.exe -enable Exceptions Handles Heaps Leak Locks Memory Threadpool TLS SRWLock -for $application
|
||||
$onlyLog = 0x181;
|
||||
$codes = @(
|
||||
# Exceptions
|
||||
0x650,
|
||||
# Handles
|
||||
0x300, 0x301, 0x302, 0x303, 0x304, 0x305,
|
||||
# Heaps
|
||||
0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, 0x008, 0x009, 0x00A, 0x00B, 0x00C, 0x00D, 0x00E, 0x00F, 0x010, 0x011, 0x012, 0x013, 0x014,
|
||||
# Leak
|
||||
0x900, 0x901, 0x902, 0x903, 0x904, 0x905, 0x906,
|
||||
# Locks
|
||||
0x200, 0x201, 0x202, 0x203, 0x204, 0x205, 0x206, 0x207, 0x208, 0x209, 0x210, 0x211, 0x212, 0x213, 0x214, 0x215,
|
||||
# Memory
|
||||
0x600, 0x601, 0x602, 0x603, 0x604, 0x605, 0x606, 0x607, 0x608, 0x609, 0x60A, 0x60B, 0x60C, 0x60D, 0x60E, 0x60F, 0x610, 0x612, 0x613, 0x614, 0x615, 0x616, 0x617, 0x618, 0x619, 0x61A, 0x61B, 0x61C, 0x61D, 0x61E,
|
||||
# SRWLock
|
||||
0x250, 0x251, 0x252, 0x253, 0x254, 0x255, 0x256, 0x257,
|
||||
# TSL
|
||||
0x350, 0x351, 0x352,
|
||||
# ThreadPool
|
||||
0x700, 0x701, 0x702, 0x703, 0x704, 0x705, 0x706, 0x707, 0x708, 0x709, 0x70A, 0x70B, 0x70C, 0x70D
|
||||
);
|
||||
appverif.exe -configure $codes -for $application -with ErrorReport=$onlyLog
|
||||
}
|
||||
|
||||
function Shutdown-appverif($application)
|
||||
{
|
||||
appverif.exe -export log -for $application -with To=$LogsFolder\$application.xml Log=0
|
||||
appverif.exe -disable * -for $application
|
||||
}
|
||||
|
||||
$DumpFolder = "$PSScriptRoot\..\artifacts\dumps"
|
||||
if (!(Test-Path $DumpFolder))
|
||||
{
|
||||
New-Item $DumpFolder -ItemType Directory;
|
||||
}
|
||||
$DumpFolder = Resolve-Path $DumpFolder
|
||||
|
||||
$LogsFolder = "$PSScriptRoot\..\artifacts\logs"
|
||||
if (!(Test-Path $LogsFolder))
|
||||
{
|
||||
New-Item $LogsFolder -ItemType Directory;
|
||||
}
|
||||
$LogsFolder = Resolve-Path $LogsFolder
|
||||
|
||||
$werHive = "HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting";
|
||||
$ldHive = "$werHive\LocalDumps";
|
||||
|
||||
|
||||
$cdb = "c:\Program Files (x86)\Windows Kits\10\Debuggers\x64\cdb.exe"
|
||||
if (!(Test-Path $cdb))
|
||||
{
|
||||
$downloadedFile = [System.IO.Path]::GetTempFileName();
|
||||
$downloadedFile = "$downloadedFile.exe";
|
||||
Invoke-WebRequest -Uri "https://go.microsoft.com/fwlink/p/?linkid=870807" -OutFile $downloadedFile;
|
||||
& $downloadedFile /features OptionId.WindowsDesktopDebuggers /norestart /q;
|
||||
}
|
||||
|
||||
if ($Mode -eq "Setup")
|
||||
{
|
||||
#Setup-appverif w3wp.exe
|
||||
#Setup-appverif iisexpress.exe
|
||||
|
||||
if (!(Test-Path $ldHive ))
|
||||
{
|
||||
New-Item -Path $werHive -Name LocalDumps
|
||||
}
|
||||
|
||||
New-ItemProperty $ldHive -Name "DumpFolder" -Value $DumpFolder -PropertyType "ExpandString" -Force;
|
||||
New-ItemProperty $ldHive -Name "DumpCount" -Value 15 -PropertyType "DWORD" -Force;
|
||||
New-ItemProperty $ldHive -Name "DumpType" -Value 2 -PropertyType "DWORD" -Force;
|
||||
|
||||
Restart-Service WerSvc
|
||||
}
|
||||
|
||||
if ($Mode -eq "Shutdown")
|
||||
{
|
||||
Remove-Item $ldHive -Recurse -Force
|
||||
|
||||
#Shutdown-appverif w3wp.exe
|
||||
#Shutdown-appverif iisexpress.exe
|
||||
|
||||
foreach ($dump in (Get-ChildItem -Path $DumpFolder -Filter "*.dmp"))
|
||||
{
|
||||
if (Test-Path $cdb)
|
||||
{
|
||||
& $cdb -z $dump.FullName -y "https://msdl.microsoft.com/download/symbols" -c ".loadby sos coreclr;!sym noisy;.reload /f;.dumpcab -a $($dump.FullName).cab;q;"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Exit 0;
|
||||
|
|
@ -1,96 +0,0 @@
|
|||
##########################################################
|
||||
# NOTE:
|
||||
# For running test automation, following prerequisite required:
|
||||
#
|
||||
# 1. On Win7, powershell should be upgraded to 4.0
|
||||
# https://social.technet.microsoft.com/wiki/contents/articles/21016.how-to-install-windows-powershell-4-0.aspx
|
||||
# 2. url-rewrite should be installed
|
||||
# 3. makecert.exe tools should be available
|
||||
##########################################################
|
||||
|
||||
# Replace aspnetcore.dll with the latest version
|
||||
copy C:\gitroot\AspNetCoreModule\artifacts\build\AspNetCore\bin\Release\x64\aspnetcore.dll "C:\Program Files\IIS Express"
|
||||
copy C:\gitroot\AspNetCoreModule\artifacts\build\AspNetCore\bin\Release\x64\aspnetcore.pdb "C:\Program Files\IIS Express"
|
||||
|
||||
|
||||
# Enable appverif for IISExpress.exe
|
||||
appverif /verify iisexpress.exe
|
||||
|
||||
# Set the AspNetCoreModuleTest environment variable with the following command
|
||||
cd C:\gitroot\AspNetCoreModule\test\AspNetCoreModule.Test
|
||||
dotnet restore
|
||||
dotnet build
|
||||
$aspNetCoreModuleTest="C:\gitroot\AspNetCoreModule\test\AspNetCoreModule.Test\bin\Debug\net46"
|
||||
|
||||
if (Test-Path (Join-Path $aspNetCoreModuleTest aspnetcoremodule.test.dll))
|
||||
{
|
||||
# Clean up applicationhost.config of IISExpress
|
||||
del $env:userprofile\documents\iisexpress\config\applicationhost.config -Confirm:$false -Force
|
||||
Start-Process "C:\Program Files\IIS Express\iisexpress.exe"
|
||||
Sleep 3
|
||||
Stop-Process -Name iisexpress
|
||||
|
||||
# Create sites
|
||||
(1..50) | foreach { md ("C:\inetpub\wwwroot\AspnetCoreHandler_HelloWeb\foo" + $_ ) 2> out-null }
|
||||
(1..50) | foreach { copy C:\gitroot\AspNetCoreModule\test\StressTestWebRoot\web.config ("C:\inetpub\wwwroot\AspnetCoreHandler_HelloWeb\foo" + $_ ) }
|
||||
(1..50) | foreach {
|
||||
$path = ("C:\inetpub\wwwroot\AspnetCoreHandler_HelloWeb\foo" + $_ )
|
||||
$appPath = "/foo"+$_
|
||||
& "C:\Program Files\IIS Express\appcmd.exe" add app /site.name:"WebSite1" /path:$appPath /physicalPath:$path
|
||||
}
|
||||
|
||||
<#(1..50) | foreach {
|
||||
$configpath = ("WebSite1/foo" + $_)
|
||||
$value = "C:\inetpub\wwwroot\AspnetCoreHandler_HelloWeb\foo" + $_ + ".exe"
|
||||
& "C:\Program Files\IIS Express\appcmd.exe" set config $configpath -section:system.webServer/aspNetCore /processPath:$value
|
||||
}
|
||||
(1..50) | foreach { copy C:\inetpub\wwwroot\AspnetCoreHandler_HelloWeb\foo.exe ("C:\inetpub\wwwroot\AspnetCoreHandler_HelloWeb\foo" + $_ +".exe") }
|
||||
(1..50) | foreach {
|
||||
$configpath = ("WebSite1/foo" + $_)
|
||||
$value = "%AspNetCoreModuleTest%\AspnetCoreApp_HelloWeb\foo" + $_ + ".exe"
|
||||
& "C:\Program Files\IIS Express\appcmd.exe" set config $configpath -section:system.webServer/aspNetCore /processPath:$value /apphostconfig:%AspNetCoreModuleTest%\config\applicationhost.config
|
||||
|
||||
$value = "%AspNetCoreModuleTest%\AspnetCoreApp_HelloWeb\AutobahnTestServer.dll"
|
||||
& "C:\Program Files\IIS Express\appcmd.exe" set config $configpath -section:system.webServer/aspNetCore /arguments:$value /apphostconfig:%AspNetCoreModuleTest%\config\applicationhost.config
|
||||
}
|
||||
#>
|
||||
|
||||
# Start IISExpress with running the below command
|
||||
&"C:\Program Files\Debugging Tools for Windows (x64)\windbg.exe" /g /G "C:\Program Files\IIS Express\iisexpress.exe"
|
||||
|
||||
|
||||
# 6. Start stress testing
|
||||
(1..10000) | foreach {
|
||||
if ($_ % 2 -eq 0)
|
||||
{
|
||||
("Recycling backend only")
|
||||
stop-process -name dotnet
|
||||
(1..50) | foreach { del ("C:\inetpub\wwwroot\AspnetCoreHandler_HelloWeb\foo" + $_ + "\app_offline.htm") -confirm:$false -Force 2> out-null }
|
||||
stop-process -name dotnet
|
||||
}
|
||||
else
|
||||
{
|
||||
("Recycling backedn + enabling appoffline ....")
|
||||
stop-process -name dotnet
|
||||
(1..50) | foreach { copy C:\gitroot\AspNetCoreModule\test\StressTestWebRoot\app_offline.htm ("C:\inetpub\wwwroot\AspnetCoreHandler_HelloWeb\foo" + $_ ) }
|
||||
}
|
||||
Sleep 1
|
||||
|
||||
(1..10) | foreach {
|
||||
(1..50) | foreach {
|
||||
invoke-webrequest ("http://localhost:8080/foo"+$_) > $null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Stress test idea
|
||||
# 1. Use Web Stress Tester
|
||||
# 2. Run stop-process -name dotnet
|
||||
# 3. Hit Q command to IISExpress console window
|
||||
# 4. Use app_offline.htm
|
||||
# 5. Save dummy web.config
|
||||
}
|
||||
|
||||
// bp aspnetcore!FORWARDING_HANDLER::FORWARDING_HANDLER
|
||||
// bp aspnetcore!FORWARDING_HANDLER::~FORWARDING_HANDLER
|
||||
Loading…
Reference in New Issue