8

当我将云服务部署到 Windows Azure 时,它​​会导致许多 VSPerf.exe 实例启动——从 1 到 5 不等。

在它们之间,它们消耗了所有的 CPU,并且没有一个进程会自行终止。

如果我远程连接到实例并手动终止进程,它们会在下一个请求时重新启动。如果进程在请求期间终止,则请求成功并且页面按预期显示和运行。

这之间的唯一区别是以前的部署是我已经升级到 .NET 4.5,因此将云服务升级到服务器 2012。

这可能是什么原因造成的?

更新

每次启动失败都会记录 2 个事件:

  • VsPerf Tool Error: Error starting data collection with a dedicated process D:\Program Files (x86)\Microsoft Visual Studio 11.0\Team Tools\Performance Tools\VSPerf.

  • .NET Runtime version 4.0.30319.18010 - Loading profiler failed during CoCreateInstance. Profiler CLSID: '{44a86cad-f7ee-429c-83eb-f3cde3b87b70}'. HRESULT: 0x80040111. Process ID (decimal): 1444. Message ID: [0x2504].

更新 2

VSPerf 问题在创建新实例或重新映像机器后不会发生(至少目前这是一个修复(一个烦人且耗时的修复))。

4

3 回答 3

9

检查 Visual Studio 中的 Azure 发布设置,我敢打赌您已在“高级”选项卡上启用了分析。

VS 发布设置

于 2013-02-22T20:27:31.047 回答
4

同样的问题,VSPerf.exe 的 2 个进程在第二个角色实例上消耗 100% 的 CPU。IIS 在该实例上变得无响应。4 个月前我们遇到了完全相同的问题,当我们使用 MSFT 支持调试此问题时启用分析时“不知何故”消失了(MSFT 内部有人知道这个问题)。但是由于无法重现问题(我们只有屏幕截图),它被删除了。

由于我在 5 分钟前再次看到它,并且由于 Azure SDK 2.0 可以轻松获取诊断日志(与 SDK 1.8 中的配置仪式不同),这里有一些有用的东西可以让下一个人理解

核心错误在于Application VsPerf Tool Error: Error starting data collection with a dedicated process D:\Program Files (x86)\Microsoft Visual Studio 11.0\Team Tools\Performance Tools\VSPerf.下面的详细日志(4 个条目)。有趣的是,我有 2 个 VSPerf.exe 进程燃烧 100% 的 CPU,并且还有 2 个日志条目....

{555908d1-a6d7-4695-8e1e-26931d2012f4}  Service Control Manager 7011    System  A timeout (30000 milliseconds) was reached while waiting for a transaction response from the iphlpsvc service.  <Event xmlns='http://schemas.microsoft.com/win/2004/08/events/event'><System><Provider Name='Service Control Manager' Guid='{555908d1-a6d7-4695-8e1e-26931d2012f4}' EventSourceName='Service Control Manager'/><EventID Qualifiers='49152'>7011</EventID><Version>0</Version><Level>2</Level><Task>0</Task><Opcode>0</Opcode><Keywords>0x8080000000000000</Keywords><TimeCreated SystemTime='2013-06-23T17:37:25.557218700Z'/><EventRecordID>1269</EventRecordID><Correlation/><Execution ProcessID='520' ThreadID='1104'/><Channel>System</Channel><Computer>RD00155DA909B8</Computer><Security/></System><EventData><Data Name='param1'>30000</Data><Data Name='param2'>iphlpsvc</Data></EventData></Event>   WebApp_IN_1 6/23/2013 5:37 PM   2   520 1104
{555908d1-a6d7-4695-8e1e-26931d2012f4}  Service Control Manager 7011    System  A timeout (30000 milliseconds) was reached while waiting for a transaction response from the Schedule service.  <Event xmlns='http://schemas.microsoft.com/win/2004/08/events/event'><System><Provider Name='Service Control Manager' Guid='{555908d1-a6d7-4695-8e1e-26931d2012f4}' EventSourceName='Service Control Manager'/><EventID Qualifiers='49152'>7011</EventID><Version>0</Version><Level>2</Level><Task>0</Task><Opcode>0</Opcode><Keywords>0x8080000000000000</Keywords><TimeCreated SystemTime='2013-06-23T17:37:56.259560100Z'/><EventRecordID>1270</EventRecordID><Correlation/><Execution ProcessID='520' ThreadID='1104'/><Channel>System</Channel><Computer>RD00155DA909B8</Computer><Security/></System><EventData><Data Name='param1'>30000</Data><Data Name='param2'>Schedule</Data></EventData></Event>   WebApp_IN_1 6/23/2013 5:37 PM   2   520 1104
00000000-0000-0000-0000-000000000000    VSPERF  4100    Application VsPerf Tool Error: Error starting data collection with a dedicated process D:\Program Files (x86)\Microsoft Visual Studio 11.0\Team Tools\Performance Tools\VSPerf. <Event xmlns='http://schemas.microsoft.com/win/2004/08/events/event'><System><Provider Name='VSPERF'/><EventID Qualifiers='57635'>4100</EventID><Level>2</Level><Task>0</Task><Keywords>0x80000000000000</Keywords><TimeCreated SystemTime='2013-06-23T17:40:37.000000000Z'/><EventRecordID>266</EventRecordID><Channel>Application</Channel><Computer>RD00xxxxxxxxx</Computer><Security/></System><EventData><Data>Error starting data collection with a dedicated process D:\Program Files (x86)\Microsoft Visual Studio 11.0\Team Tools\Performance Tools\VSPerf.</Data></EventData></Event> WebApp_IN_1 6/23/2013 5:40 PM   2   0   0
00000000-0000-0000-0000-000000000000    VSPERF  4100    Application VsPerf Tool Error: Error starting data collection with a dedicated process D:\Program Files (x86)\Microsoft Visual Studio 11.0\Team Tools\Performance Tools\VSPerf. <Event xmlns='http://schemas.microsoft.com/win/2004/08/events/event'><System><Provider Name='VSPERF'/><EventID Qualifiers='57635'>4100</EventID><Level>2</Level><Task>0</Task><Keywords>0x80000000000000</Keywords><TimeCreated SystemTime='2013-06-23T17:40:41.000000000Z'/><EventRecordID>267</EventRecordID><Channel>Application</Channel><Computer>RD00xxxxxxxxx</Computer><Security/></System><EventData><Data>Error starting data collection with a dedicated process D:\Program Files (x86)\Microsoft Visual Studio 11.0\Team Tools\Performance Tools\VSPerf.</Data></EventData></Event> WebApp_IN_1 6/23/2013 5:40 PM   2   0   0
于 2013-06-23T17:51:57.897 回答
0

我发现最接近解决方法的是创建启动任务

<Task commandLine="VSPerf.cmd" executionContext="elevated" taskType="background" />

VSPerf.cmd简单的启动器在哪里

PowerShell -ExecutionPolicy Unrestricted .\VSPerf.ps1
exit /B 0

对于试图杀死过度活跃的 VSPerf 实例的 PowerShell 脚本:

function Restart-VSPerf {
    $procs = (
        gwmi -Query "SELECT IDProcess,PercentProcessorTime FROM Win32_PerfFormattedData_PerfProc_Process WHERE Name='vsperf' AND PercentProcessorTime > 25" |
        Foreach-Object { $_pid = $_.IDProcess ; gwmi -Query "SELECT Handle,CommandLine FROM win32_process WHERE Name='vsperf.exe' AND Handle=$_pid" | Select-Object Handle, CommandLine }
    )
    if ($procs) {
        # Get VSPerf path.
        # NB The regex uses conditional matching with an expression, as described in https://msdn.microsoft.com/en-us/library/36xybswe.aspx
        # to ensure that a single capturing group gets the contents of quoted arguments and unquoted arguments.
        $regex = [regex] '^(("?)((?(?<=")[^"]*|[^"\s]*))\2(\s+|$))+$'
        $vsperf = $regex.Match($procs[0].CommandLine).Groups[3].Captures[0].Value

        & $vsperf /detach

        # Kill
        $procs | Foreach-Object { Stop-Process -Force -Id $_.Handle }

        # Restart
        Start-Sleep -s 1
        $procs | Foreach-Object {
            $_args = ($regex.Match($_.CommandLine).Groups[3].Captures[1..99] |  Select-Object -ExpandProperty Value)
            Start-Process $vsperf -ArgumentList "$_args"
        }
    }
}

while (1) {
    Start-Sleep -s 180
    Restart-VSPerf
}

它有时会起作用,但并非总是如此。欢迎提出可靠性改进建议。

于 2015-10-23T12:56:47.153 回答