-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Analyzer freezes multiple times per hour #47851
Comments
It seems like there are two issues here:
I'm not sure about the first one, but it may be helpful to enable the server instrumentation log. If you run the Preferences: Open Workspace Preferences command in your project, then set the The second issue I think is likely similar to Dart-Code/Dart-Code#3555 which is where a plugin ( |
I spoke too soon - these were for two different locations as I moved my mouse around. @friebetill do you see the duplicate hovers always, or only after some time/some restarts? |
In case if the instrumentation log does not show exceptions, and we have an infinite loop somewhere in the server, enabling Observatory and looking at CPU profile might allow us to see where this cycling happens. Although this will require some investigation on your side. See a similar discussion. |
I no longer think the duplicates are related to Dart-Code/Dart-Code#3555. In that case we were ending up with two registrations, whereas what I saw today was a single registration with two document selectors for Dart. It appears that this is fine and does not trigger multiple calls (which is why I didn't see it). @friebetill when you next see duplicate content in the hover/mouseover, could you do the following:
Any lines in that log that contain |
I see the duplicate entries only after some time and not immediately after I start VSCode. Right now the duplications occurred after a few minutes without me restarting the analyzer. Here are the logs I recorded with `Dart: Capture Analysis Server Logs`.
I will add the logs with It may very well be related to the plugin |
@friebetill thanks! This confirms VS Code is sending two requests to the server, so it does seem consistent with duplicate registrations. I suspect dart_code_metrics may be the trigger (since it affects the registrations), although the bug is likely not with that plugin but rather the server. If you can extract all lines with |
Here are all lines (3) of the
What might be interesting is that there are about 100000 lines in the file and about 95% of the lines look similar to this one:
Here is
|
@friebetill thanks! I can't se anything wrong with the first set of capabilities, but in the second one something is certainly wrong, as there is an I'll try to figure out how that's happened.
Are they for the same file path, or different? It's no unusual to get a large number of these for different files, though if they're for the same file that seems wrong. Are you able to include a slightly larger snippet from that file? |
In each line a different file is referenced. I can send you the log file privately if it helps find the problem. Thank you for all your efforts to find the cause! |
I have a fix out for review for the duplicate registrations. It occurred when we tried to rebuild the registrations twice concurrently (this could be triggered by multiple plugin events). With this change the unregister/register requests will be made atomically: https://dart-review.googlesource.com/c/sdk/+/222303/ I'm not certain this resolves the whole issue though. It would certainly have resulted in worse performance (since a lot of things would be done multiple times) but I don't know if it would seem like it's completely frozen. The last lines of an instrumentation log when you experience the freeze (before you restart) may be useful to track that down.
That sounds like expected behaviour then. Possibly there's some optimisation that could be done here (not re-sending an empty error set if no errors have previously been sent) but I doubt that's causing any noticeable performance drop (unless it seems to be happening repeatedly when it shouldn't). |
…tically Fixes at least some of the issues in #47851. Change-Id: Id92a1aa82b55d9fda244e7fd279028db392777d8 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/222303 Reviewed-by: Brian Wilkerson <[email protected]>
Here are the last lines of the log before the analyzer froze
I don't know if the lines are relevant, in case lines before are still needed I saved those. |
@friebetill thanks! Unfortunately I can't see anything unusual in the log. It seems like all of the requests logged (both to the server, and then to the dart_code_metrics plugin) completed successfully. When this occurred, exactly what were the symptoms/behaviour you saw? And if you click Help -> Toggle Developer Tools in VS Code and check the Console tab, are there any errors? Otherwise, I think it would be useful to review the analysis servers isolates in Observatory as @scheglov suggested, although there are currently some issues that make it a little trickier to access the VM Service for the analysis server through VS Code and LSP - I'll post back some instructions when I've resolved some of them. |
Are you still seeing this issue with Dart v2.16? There were fixes made for Dart-Code/Dart-Code#3761 that solved some race conditions when using plugins that analyzed Dart files. |
I deactivated |
Ok, will close. Please do ping if you (or anyone else reading) is seeing this on >= v2.16 of Dart though. Thanks! |
I already created a discussion on Reddit and was referred to this repository to post an issue.
The issue is that the analyzer doesn't run stable and I have to restart it several times within an hour. I can tell that the analyzer is no longer responding because the code is underlined in red in odd places and the places don't change even if I rewrite the code. Then I have to restart the analyzer with the command
Dart: Restart Analysis Server
. After a few seconds, I can continue programming. Nevertheless, the problem is quite annoying, since I sometimes think that my code is incorrect, although only the analyzer is freezed. On Reddit it sounds like several people are having the problem with VSCode, but there are no issues with Android Studio.Here is a picture of what this looks like
Additionally, I noticed that often there are the same entries in the code suggestions. However, I do not know if the two problems have the same cause.
Here is a picture of what this looks like
I use macOS Monterey as my OS, but have also seen the problem on macOS Big Sur and Windows. My editor is VSCode, I haven't programmed with Android Studio for a long time.
My project has about 160k lines of code and I use a lot of linter rules
Some technical data:
Unfortunately I don't know how to create a reproducing example of the problem or how to find the necessary logs for this issue.
The text was updated successfully, but these errors were encountered: