perfview icon indicating copy to clipboard operation
perfview copied to clipboard

[Exception Occurred: System.Runtime.InteropServices.COMException (0x80070296): Exception from HRESULT: 0x80070296

Open SilverNarcissus opened this issue 3 years ago • 1 comments

When I'm running prefview in the windows container, I encounter this exception:

[Exception Occurred: System.Runtime.InteropServices.COMException (0x80070296): Exception from HRESULT: 0x80070296
   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
   at Microsoft.Diagnostics.Tracing.Extensions.ETWControl.EnableStackCaching(UInt64 traceHandle)
   at Microsoft.Diagnostics.Tracing.Session.TraceEventSession.EnableKernelProvider(Keywords flags, Keywords stackCapture)
   at PerfView.CommandProcessor.Start(CommandLineArgs parsedArgs)
   at PerfView.CommandProcessor.Collect(CommandLineArgs parsedArgs)
   at PerfView.CommandProcessor.ExecuteCommand(CommandLineArgs parsedArgs)]

Here is my usage:

  1. Download the latest prefview from: https://github.com/microsoft/perfview/releases/download/v3.0.6/PerfView.exe
  2. Copy the PerfView.exe into the windows container
  3. use crictl exec <contianer id> powershell command to open a Powershell in the container
  4. Running the command
.\PerfView "/DataFile:PerfViewData.etl" /BufferSizeMB:256 /StackCompression /CircularMB:500 /logFile=log.txt /maxCollectSec=30 /NoGui collect

My windows container's base image is: mcr.microsoft.com/windows/nanoserver:1809 My isolation runtime is: runhcs-wcow-hypervisor And I have read this post: https://githublab.com/repository/issues/microsoft/perfview/1601. It said that we should use hyper-v isolation and that's exactly what I'm using.

Anything I can do about it? Thanks in advance.

SilverNarcissus avatar Nov 28 '22 09:11 SilverNarcissus

I also faced this problem when I used Docker

docker run -it mcr.microsoft.com/windows/servercore:1803 powershell

It only works when added parameter /KernelEvents:Profile like below.

.\PerfView.exe  "/DataFile:Data.etl" /BufferSizeMB:256 /StackCompression /CircularMB:500 /NoGui /AcceptEula
/MaxCollectSec:30 /LogFile=collect.log /KernelEvents:Profile collect

But it lost many details in Flame Graph, so I still want to remove this parameter when I collect PerfView.

qinzhen353 avatar Nov 29 '22 03:11 qinzhen353