-
Notifications
You must be signed in to change notification settings - Fork 712
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
COMException occuring when kernel events are collected #1723
Comments
I've done a little more investigating to try and work out what's going on, but I'm left confused. Here's a sequence of events...
I have no idea why a debugger session would sets things right. I did a little more digging to try and work out where the exception is coming from and it's happening here: perfview/src/TraceEvent/TraceEventSession.cs Line 717 in a70bb00
I might be wrong, but from what I see in the decompiled method, the only native calls made inside StartKernelSession are to |
cc @brianrob |
Hmmm... this is not something that I've seen before. It's super weird to me that running VS with the debugger would fix it, though there are some actions that VS takes that impact ETW, so I guess anything is possible. A couple of questions:
|
I ran it on a spare machine that had the same insiders build on it, and saw the same issue On the spare, I rolled back to WIn 11 21H2 and everything now works as expected. I have another machine with 21H2 still on it and it also works correctly. It's definitely feeling like something in the OS |
That it does. Would you mind filing a feedback ticket in Windows for this (hit Windows-F to open the feedback hub)? This is the best way to route this issue. If you let me know what it's called, I'll do my best to see that it's reviewed by the right folks. |
Feedback item is titled "COMException when starting a kernel level trace session" (https://aka.ms/AAi9xqw) For reference, I bumped the spare machine up to the 22H2 GA release. I thought things were working as expected, but just ran into the problem again. |
Thanks much @rbanks54! I am going to close this issue in favor of the Feedback ticket. I am working to get eyes on it. |
You'll like this @brianrob, @adamsitnik I noticed on the spare machine that while it wasn't crashing, I was also regularly seeing no data in the CPU traces. Digging around online I found an old MS Answers thread where there was a version of the virus definition package causing issues. In the same thread, I noticed some people still had issues after updating but found success by disabling real time protection. On a hunch, I tried this on the spare machine and the CPU sample data appeared correctly. I then went to the main machine and did the following:
I suspect Windows Defender is blocking the kernel mode trace and that for Win21H2 it returns CPU samples with no data, while on 22H2 it throws the COMException and causes the crash. I left the machine alone for a good while (about 6 hours) after re-enabling real time protection and it started failing again. |
@rbanks54 can you please share the Windows build numbers where things failed and where you saw them succeed? Thanks. |
@brianrob Here you go: Failing build:
Semi-broken build (no data in stacks):
Working build:
|
Thanks @rbanks54! |
Hi folks! I've experienced the same problem on Win 11 22H2: if I run PerfView with Here is what I've managed to figure out about the problem.
But as suggested in VS_issue_2 updating Windows Defender fixes the problem. But the solution only works for VS profiler and it doesn't for any other ETW-based profiler like So I went to figure out what VS Profiler does and found that after I perform profiling in VS, any other profiler starts working well and can collect kernel samples. But this effect magicaly disappears after some time and I need to start VS profiling again to make PerfView working again. As it turned out, VS Profiler uses some helper service As I later figured out, the process And the last thing worth to mention: there is a tool Further details about the performance couters and control registers can be found in the official Intel Performance Monitoring Unit programming guide. |
In the same boat here. Turning off realtime protection worked, but it's a real pity that this is not working anymore. windows 11 is the gift that keeps on giving :( . Windows Details Windows 11 Pro 22H2 |
@Xhanti have you tried to reset performance counters manually? There is a Counter Control tool that I mentioned above. It allows to reset the counters not having to write your own driver. At least for me it's the best option so far. |
The counter control tool worked great for me. Now I can use ETWProfiler with BenchmarkDotNet again. |
Up until today, perfview has been working fantastically well, but today I can't get it to start collecting data and I can't diagnose why.
Here's what I'm seeing in the log
The command line is
Adding
/KernelEvents:None
to the command line will allow the profiling to work, but without being able to get CPU samples it's not much use running things that way.I've tried rebooting and running perfview from different folders, but to no avail.
It's happening on 3.0.3 thru 3.0.5
About the only think I can think of is a Windows update that was installed overnight:
Update Stack Package - (Version 1022.921.2011.0)
(I'm on the Win 11 beta channel)I can't see why something related to the Windows update process would cause problems, so I'm doubtful it's the problem. I just can't think of anything else to try.
The text was updated successfully, but these errors were encountered: