-
Notifications
You must be signed in to change notification settings - Fork 803
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
Visual Studio constantly crashes #16869
Comments
I can't imagine what issue drags the whole VS down. Wondering if it's editor in general, or FCS itself. The fact, that it crashes not immediately, makes me think it's a memory leak or something similar. |
@Tangent-90 Never mind, I see you mentioned |
So I was just going to write "can reproduce in main" but then just in case I updated to the very latest main - and no, I cannot reproduce this anymore. I was playing with ServiceDeclarationLists and it was crashing stably within a minute or so whereas now I cannot crash whatever I do. @brianrourkeboll thanks for coming to the discussion. Do you think this PR could make any difference in this scenario? Maybe it will instantly click in your head :) Regardless, the parentheses thing may or may not be related to the original problem so I am trying to figure out more details internally. |
@psfinaki what if you find a line with unnecessary parens and try to apply "fix all in document" in E.g.:
For me, applying the fix to that line works fine, but applying it to the document does not. When you invoke "fix all in document," all files before the one you're applying it to are also parsed and checked1. When trying to apply "fix all in document," I sometimes see a stack overflow inside the call to I also sometimes instead see a stack overflow in In fact, I now keep getting the second exception and can no longer reproduce the first 🙃. Either way, I wonder if the problem might have to do with tail-call optimization not being applied when it should be? Footnotes
|
Hey @vzarytovskii I apparently can't comment on the now closed VS feedback issue, so quoting you here:
Yes, they were all F# files. I am not aware of issues with other kinds of files but we mostly work in F# in our small company - although we now also use a bit of C# on the frontend side. I have not noticed VS crashing without interaction but I won't rule it out. Perhaps I can try to collect some detailed telemetry for you, if you tell me how, and VS continues being able to crash. At least I've experienced 10-20+ crashes so far. Can I somehow enable OpenTelemetry for F# in VS or run an ETW trace with some relevant providers switched on? |
I don't think OTEL will show anything (also, no easy way of turning it on to pipe it somewhere). Do you have windows crash reporting off by any chance? Or are you cancelling it? It's just weird that there's no Watson data (data windows collects when something crashes). Or does it by any chance offer you to launch it under debugger? This will also work, since you can then look at it and (without sharing with me) can at least tell what sort of exception is that. It's also weird that I don't see that many crashes in the past 90 days, only around 5-7 spread across 17.8 and 17.9. |
For what it's worth, I also get this stack overflow when applying "fix all in document" for "remove unused binding" in |
I think I can confirm the above - my VS has crashed once I tried to apply "Simplify Names" on that whole document as well. We might have not "load tested" our code fixes to catch that earlier, but probably we also don't try to apply them on a big scale. @bent-rasmussen do you use code fixes? Do you have especially large code files? |
I looked a bit around in group policy settings and most things are "not configured" but I found out I've used a tool to disable some services and reverted a setting that seems to limit diagnostics telemetry, I didn't notice it did that :-( After that change, I tried crashing VS again:
|
I don't use code fixes a lot and they were not involved in the current issue. I'm not sure what qualifies as a large file but the one I am crashing with now is ~1300 LOC. |
D'oh! - error reporting was turned off - as you rightly suspected Vlad - but now it is enabled: New crash:
And windows error reporting:
And
|
So, what we figured out internally: It looks like the user has windows telemetry level set to "Security", which means we can't get dumps from them via Watson.
This command will enable Windows to automatically collect a crash dump and stores it under %LOCALAPPDATA%\CrashDumps Use Visual Studio normally to reproduce the crash, once a crash occurs let all Windows crash dialogs finish processing. Go to %LOCALAPPDATA%\CrashDumps and locate the latest dump file for devenv.exe process. Please zip the DMP file, reply to this thread and attach the dump using the attach / insert button (or if not available, you can upload and send to me to vlza@microsoft.com) You can run the following command to revert back dump collection to its original state:
More details at about collecting User Mode Dumps : Collecting User-Mode Dumps - Win32 apps | Microsoft Docs |
I have one strong suspicion: when I rewrote a bunch of things to state machines, some tail recursive things became non-tail recursive and might blow up now. Fix would be (when identified) to use async in them until we support tail calls in state machines. |
Hmm, yeah, the stack overflow I was seeing in The parens analyzer one being triggered in FSharp.Compiler.Service seems likely to be unrelated to the All analyzers are run for all (preceding?) files in the project when "fix all in document" is selected for a code fix in a given document. It seems like we shouldn't be doing that in general... In the FSharp.Compiler.Service project, that also means that if you run it on pretty much any other file, it is also run on |
Cancellable itself wasn't moved to state machines, so it's slightly surprising to me that changing it to async fixed things. Another suspicion I have is that we moved a bunch of things on stack (option -> voption), which essentially decreased its stack even if we use guard. This is from the dump provided. Some deeply nested expressions there. As immediate solution we can decrease threshold for the stack size, but it will take time to release. Another option is trying setting an environment variable which controls it (need to look it up once in the office). I also wonder why does it not fail in rider (or maybe it does and is getting restarted by IDE). |
A bit of explanation and what can be tried to make the situation better while we investigate what can be improved from our side; |
Sounds good! I've set |
I've not seen any crashes since the environment variable was set, despite editing that file several times. It is looking promising. (As a side-note, surely not related to this issue, VS seems to also have started showing a lot of red squigglies - even when there aren't any errors. The squigglies then disappear once I build the whole solution.) |
Thanks for testing it, Bent. Interesting, I might look at the squiggles issues once done with stack issues. |
Hmm, it could be a coincidence, but I consistently get that stack overflow with |
@brianrourkeboll kindof what fsharp/src/Compiler/Facilities/DiagnosticsLogger.fs Lines 851 to 876 in fa0329b
|
Yeah, there are similarities, but async doesn't necessarily guarantee thread switch (unless we have a bind for cancellable in async extension which does exactly that). |
We merged a workaround for this specific crash (cancellable being non-tail-recursive when running on framework CLR). This will need more investigation however. We need to profile checking and see where do we recurse, but either not under stack guard or not tail-recursive. |
This issue has been moved from a ticket on Developer Community.
[severity:It's more difficult to complete my work]
Editing a somewhat large F# file, the Visual Studio consistently/constantly crashes. I can start VS, go to the file, edit a bit and then it crashes (the start-edit-crash "inner loop"). I have the same problem with some other files in our solution.
I hope you prioritize crashes and have someone looking at the telemetry you are hopefully getting, although this has been going on for a while now.
The activity recorder does not work for me, at least not in Firefox. :-( It just starts and then immediately stops and "collects" the traces, before I have even had a chance to perform any action in VS. Is Firefox not supported?
I now also use JetBrains Rider, because VS is so unstable. I don't care about new features if VS feels like a minefield where I have to learn which files I cannot edit in due to crashes.
Original Comments
Feedback Bot on 3/7/2024, 04:07 AM:
(private comment, text removed)
Bent Rasmussen on 3/7/2024, 00:53 PM:
(private comment, text removed)
Bent Rasmussen on 3/7/2024, 00:55 PM:
(private comment, text removed)
Original Solutions
(no solutions)
The text was updated successfully, but these errors were encountered: