intellij-haskell
intellij-haskell copied to clipboard
Stack processes seems to leak on Windows
Right now, after a long day of working on my Haskell project in IntelliJ-Haskell (which was immensely helpful, thanks a lot for your work!), I see 27 (!) Stack processes in the background.
A quick PowerShell query I've performed to enumerate them:
$ WMIC PROCESS get Commandline | select-string stack.exe -Raw > T:\Temp\process.txt
I will attach the whole file as-is, but there's one interesting fact: string icfpc-mmxx-codingteam:test:modulator-test occurs 22 times across this file, which means there's 22 Stack processes with this test module in the command line. Is that right? Does the plugin has to keep them all alive?
Most of them keep around 30 MiB of memory, which is… I guess, pretty tolerable these days? But still, I'm not sure all these processes have to be kept around.
Here's the process list: process.txt
UPD: The last process in the list, stack run interactor, was started by me manually; everything else have its roots in the idea.exe process, so, obviously, these're Stack processes started by IntelliJ-Haskell for various purposes.
Thanks for reporting!
Is that right? Does the plugin has to keep them all alive?
No, that's not intended behavior.
The plugin restarts the test REPL when the user switches from library code to test code. So when something goes wrong during that restart, it's in line with your report.
On macOS and Ubuntu I never noticed this behavior. Could be a specific Windows issue... I will keep an eye on it.
@ForNeVeR Is this issue still happening?
I was able to reproduce the issue on 1.0.0-beta78 (the latest one at the moment), and 1.0.0-beta76, too. Steps to reproduce:
- Get a fresh Stack installation on Windows (I use
choco install haskell-stackfor that) - Clone this project: https://github.com/codingteam/icfpc-2020
- Wait for the project import to finish (i.e. for all build processes to finish)
- Open a file
test/Spec.hs, type something - Switch to a branch
portnov/evaluator - Open a file
test/Spec.hs(again), type something - Switch back to
master - Go to step 4
During steps 4–8, you'll see this error popup from time to time:

After each of these messages (seemingly?), stack process count will raise by two. I was eventually able to get 22 of these processes (quickly counted by (get-process stack).count in pwsh).
Note that the process tree looks like this:
(first stack.exe is a Chocolatey wrapper I have in Path)
So, when I say that the count has been increased by two, I mean that one additional subtree like this has been spawned (since it incorporates two stack.exe processes).