VS Code extension causes system slowdown with hundreds of rg.exe instances - visual-studio-code

Under unclear circumstances, our VS Code extension is causing a dramatic perf degradation due to a huge number of ripgrep (rg.exe) instances. So far I haven't been able to repro this issue, but based on user reports I believe it was introduced by this change. Can anyone provide some insight into what leads to the execution of rg.exe?
https://github.com/microsoft/vscode/issues/164665
https://github.com/microsoft/sarif-vscode-extension/issues/472
https://github.com/microsoft/sarif-vscode-extension/issues/472#issuecomment-1414396307 <- trace logs linked here
*** EDIT
I've seen the two issues cited by 'user' but they did not shed any light on the cause of this behavior.

Related

What happens to performance.mark entries when the resource buffer gets full

I am building a large private (ie used behind a firewall) PWA and wondering how to improve the diagnostics if/when my users hit issues. I already have an error manager which uses navigator.sendBeacon to log the error on the server, but that lacks detailed info of what led up to that point.
A thought I had was to liberally mark the code with performance.mark() statements and on an error dump the performance buffer to the server. It would give me an ordered list of recent activity.
However it only makes sense to do this if the browser throws away the oldest entry to make way for the new when the internal buffer is full. However all the documentation I found with a google search doesn’t mention it. I am aware I can get an event when it is full and could use that to copy and clear it but I can find no words on what happens if I ignore the event. Neither can I find a typical size. I don’t want to keep getting entries filling up the entire computer memory either
Can anyone give me a definite answer
Edit: The more I look into this, the more confused I become. It appears that you can control the size of the resourceTimingBuffer but "resource" performance entries are related to fetch and not Performance.mark(). I can't find any statement on limitations.
There are no meaningful limitations I could find. I did a test and generated more than 4000 marks and they were all there and the memory usage did not increase in any measurable way.

Want to know what allth terms in windbg output of "!analyze -v" indicates?

What the key value indicates.......and which is the term help me to undersatnd how the windbg bucket the crashes means how it braodly classify the crashes into?
help me to understand the windbg bucket
IMHO, the idea of buckets was introduced for WER (Windows Error Reporting). WER was used by Microsoft but was also available for companies. WER included a service where you could log in on a Microsoft website and then get an overview of your application crashes.
Of course, people were not interested in a flat list of crashes, but they wanted to know how many crashes of the same type occured. Thus Microsoft and other company could focus on fixing those bugs first which affected most of the users.
The bucket, as the name suggests, is a container where similar problems grouped. The bucket ID is generated in 2 phases: a labeling process which was done on the client side and a classifying process which was done on server side.
What you get from !analyze is the classification, so basically you have access to the functionality via WinDbg that Microsoft used on the server side for providing the WER services.
These WER services are not available any more. They hae been replaced by something else, but I have forgotten the name.
how it braodly classify the crashes into?
An ideal bucketing algorithm would create a new bucket for each bug. So the number of buckets is just limited by the amount of bugs you can code into your application.
The command !analyze has implemented more than 500 different heuristics. The combination of these can create more than 25.000.000 different buckets.
Buckets can differ because of
stack
modules
function name
function offset
corruptions (heap corruption, image corruption)
detected malware
known outdated programs or libraries
known defective hardware
exception codes
exception subcodes
...
The result of that bucketing process is this line of output:
FAILURE_BUCKET_ID: BREAKPOINT_80000003_ntdll.dll!LdrpDoDebuggerBreak
which is probably somehow equivalent to this hash:
FAILURE_ID_HASH: {06f54d4d-201f-7f5c-0224-0b1f2e1e15a5}
I have read some of your previous questions in the windbg tag and I get the impression that you want to use the bucket ID to display some meaningful information to humans.
Actually, the WER system provided such a feature. It worked like this: a developer analyzes the crashes in a bucket and finds out what to do (e.g. update a driver, install a newer version of the application etc). He then assigns that bucket ID a text. Any customers that experience the same crash again were redirected to a website at Microsoft that contained the text written by the developer.
However, note that there is no magic involved that would transfer a crash into something human readable. That's the developer doing hard work and then creating a mapping from the bucket ID to some text that is displayed.
IMHO, the latter can easily be achieved. However, any new bug will require an analysis first. But, who knows, maybe we can train an AI that does better at this.
For more on buckets etc. please read the Microsoft paper Debugging in the (Very) Large:Ten Years of Implementation and Experience

OrientDB Lightweight Edges with Ridbags?

Recently I've come across a use case where it made a lot of sense to use lightweight edges. It made for much faster queries when checking whether two vertices are related as part of the select conditional.
That said, because I operate in a highly concurrent environment, I've run into some conflicts (OConcurrentModificationException). I got past this by setting the conflict strategy to auto-merge for that particular class.
In investigating further, I came across this article on concurrency when adding edges: http://orientdb.com/docs/2.1/Concurrency.html#concurrency-when-adding-edges
It recommends using RID Bags for situations where edges change very frequently, and has the neat advantage of not incrementing the version each time an edge is added/removed. Sounds great, but I can't get it to work.
I've tried adding the -DridBag.embeddedToSbtreeBonsaiThreshold=-1 to my client, with no effect. I then went into my code and added:
OGlobalConfiguration.RID_BAG_EMBEDDED_TO_SBTREEBONSAI_THRESHOLD.setValue(-1);
I finally also tried adding the -DridBag.embeddedToSbtreeBonsaiThreshold=-1 to my orientdb server (in server.sh).Still no effect. Each time the edges get updated, the version gets incremented (which is how I assume I can tell that its not working properly).
Does anybody have thoughts about how lightweight edges might work with ridbags (or not work for that matter)?
Thanks!

What are these DebugManager and WinIOErrors inside the Workflow invoke method?

I'm running the ANTS Performance Profiler in my windows service to optimize it. So I found out that the execution of one of my workflow is about 436 milliseconds. I drilled down each methods being executed inside the invoke method of my workflow and found the result as shown in the image below.
What is the DebugManager above? Why is there a WinIOError? Sorry for the noob questions guys I'm just lost here. I really just want to shortened the execution time if possible.
Sounds like you are running a debug build from withing VS, never the best way to measure the real performance as that means runtime optimizations are disabled.
Anyway if you are looking for the maximum performance WF4 is not the thing. Due to the asynchronous nature of WF4 execution it is always going to be somewhat hard to predict. And there is always ging to be a bit of overhead with the runtime and all activities involved which means that a simple C# function is always going to run faster.

Analysing and generating statistics on your code

I was wondering if anyone had any ideas or procedures for generating general statistics on your source code.
Off the top of my head I would love to know how many functions in my project's code are called once or very few times or any classes that are only instantiated once.
I'm sure there is a ton of other interesting things to be found out.
I could do something like the above using grep magic but has anyone come across tools or tips?
Coverity is the first thing coming to mind. It currently offers (on one of their products)
Software DNA Map™ analysis system: Generates a comprehensive representation of the entire build system including a semantically correct parsing of every line of code.
Defect Manager: Intuitive interface makes it easy to establish ownership of defects and resolve them via a customized workflow that mirrors your existing development process.
Local Analysis: Enables code to be analyzed locally on developers’ desktops to ensure quality before sharing with other developers.
Boolean Satisfiability: Translates the code into questions based on Boolean values, then applies SAT solvers for the most accurate defect detection and the lowest false positive rate available. Only Prevent offers the added precision of this proprietary method.
Race Conditions Checker: Features an industry-first race conditions checker built specifically for today’s complex multi-threaded applications.
Path Simulation: Simulates 100% of all values and data paths, enabling detection of the most critical defects.
Statistical & Interprocedural Analysis: Ensures a comprehensive analysis of your entire build system by inferring correct behavior based on previously observed behavior and performing whole-program analysis similar to the executing Bin.
False Path Pruning: Efficiently removes false positives to give Prevent an average FP rate of about 15%, with some users reporting FP rates of as low as 5%.
Incremental Analysis: Analyzes source code wholly or incrementally, allowing you to save time by checking only those components that are affected by a change.
Reporting: Measures software quality trends over time via customizable reporting so you can show defects grouped by checker, classification, component, and other defect information.
There are lots of tools that do this. But afaik none of them are language independent (which in turn would be mostly impossible e.g. some languages might not even have functions).
Generally you will find those tools under the categories of "code coverage tools" or "profilers".
For .Net you can use Visual Studio or Clrprofiler.