cwtools / cwtools-vscode

A VS Code extension providing language server support for paradox script files using cwtools
https://cwtools.github.io/
Other
91 stars 12 forks source link

Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. #109

Closed KainAudron closed 3 months ago

KainAudron commented 3 months ago

Hello,

I am getting a constant error in VSCode as well as VSCode insider pertaining to memory

Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

Attaching a log

VSCode Insider Log.txt

I have run memory and drive diagnostics and even added VSCode in exceptions in Windows Defender and I can not for the life of me get it to work...

Because of these errors VSCode at some point at the end of initialization says that it can no longer connect to Paradox Language Server and effectively will not attempt to do so again

This happens with all games so it's not Stellaris exclusive (which is the game I am trying to mod)

I even went as far as deleting all files from the mod folder except the ethics.txt file from Stellaris to try to minimize all the possible interferences and isolate the issue.

Would anyone be able to help me with this?

KainAudron commented 3 months ago

Also attaching a regular VSCode Log since they seem to be slightly different just in case VSCode Log.txt

tboby commented 3 months ago

The three stack traces are completely different, and one is in a very stable external library.

It's basically just falling over with something that should only be possible in "unmanaged" code. As cwtools doesn't use unmanaged code it would need to be three separate bugs in F#/C# itself, which is very unlikely.

cwtools is very CPU and memory intensive, more so than most applications are, so it might just be triggering a fault in hardware. You say you've run memory diagnostics: Have you run something like https://www.memtest86.com/, outside of your operating system?

Is anything else crashing recently? If I was you I would seriously consider making some backups in case you get random file corruption from this!

Next things to try would be a linux "livecd" usb stick, installing VS Code on that and confirming whether or not it happens there too.

KainAudron commented 3 months ago

Ummm actually...

The moment you mentioned CPU I tried using Project Lasso to force VSCode to only use 8/32 Cores... and now it works...

It's the same way I made sure Vic3 doesn't crash constantly...

I kinda feel foolish now...

Thank you very much for the assistance and time!

tboby commented 3 months ago

Does that tool let you specify which cores to use? Does it fall over if you use a different set?

It sounds like a faulty CPU to me!

KainAudron commented 3 months ago

Hello, yes it allows me to choose which cores to use

But the CPU shouldn't be an issue all the diagnostics run fine, it's a matter of concomitency due to software not being parametered to work for latest i9 14900k processors