haskell / haskell-ide-engine

The engine for haskell ide-integration. Not an IDE
BSD 3-Clause "New" or "Revised" License
2.38k stars 212 forks source link

stack install fails with a VirtualAlloc failed #1701

Closed mrakgr closed 4 years ago

mrakgr commented 4 years ago

The only thing I did to get to this point was to clone the repo and then ran stack .\install.hs hie in the E:\hie directory.

Extracting  ghc-8.6.4\mingw\x86_64-w64-mingw32\lib\libxinput9_1_0.a
Extracting  ghc-8.6.4\mingw\x86_64-w64-mingw32\lib\libzoneoc.a
Extracting  ghc-8.6.4\mingw\x86_64-w64-mingw32\lib\txtmode.o
Extracting  ghc-8.6.4\perl
Extracting  ghc-8.6.4\perl\perl.exe
Extracting  ghc-8.6.4\perl\perl56.dll

Everything is Ok

Folders: 473
Files: 5746
Size:       931282716
Compressed: 935936000
Updating package index Hackage (mirrored at https://s3.amazonaws.com/hackage.fpc                                                                                [1 of 2] Compiling Main             ( C:\Users\Marko\AppData\Roaming\stack\setup-exe-src\setup-Z6RU0evB.hs, C:\Users\Marko\AppData\Roaming\stack\setup-exe-src\setup-Z6RU0evB.o )
stack: getMBlocks: VirtualAlloc MEM_COMMIT failed: The paging fileg is htoo smcall for .thisE operatioXn to Ecom:ple te.g
etMBlocks: VirtualAlloc MEM_COMMIT failed: The paging file is too small for this operation to complete.

Here is a partial dump. It seems it finishes extracting GHC 8..6.4 and then fails a memory allocation after moving to the next step.

The paging fileg is htoo smcall for .thisE operatioXn to Ecom:ple te.g

I do not know why a part of the error message is garbled here.

mrakgr commented 4 years ago

It seems running the command again allows the installer to move past the error.

Progress 11/16: filepattern-0.1.1, primitive-0.6.4.0, unordered-containers-0.2.9                                                                                # stack (for check)

********************************************************************************
The `stack` executable is outdated.
found version is `1.9.3`.
required version is `2.1.1`.
Please run `stack upgrade` to upgrade your stack installation
********************************************************************************

Error when running Shake build system:
  at want, called at src\Development\Shake\Internal\Args.hs:83:69 in shake-0.18.5-3e6CcyDVSLz6hqfujz75lJ:Development.Shake.Internal.Args
* Depends on: hie
  at apply1, called at src\Development\Shake\Internal\Rules\Rerun.hs:41:5 in shake-0.18.5-3e6CcyDVSLz6hqfujz75lJ:Development.Shake.Internal.Rules.Rerun
* Depends on: data
  at apply1, called at src\Development\Shake\Internal\Rules\Rerun.hs:41:5 in shake-0.18.5-3e6CcyDVSLz6hqfujz75lJ:Development.Shake.Internal.Rules.Rerun
* Depends on: check
  at error, called at src\\Stack.hs:49:5 in hie-install-0.8.1.0-3VU8M1YxYd01ftY5inxIor:Stack
* Raised the exception:
The `stack` executable is outdated.
found version is `1.9.3`.
required version is `2.1.1`.
Please run `stack upgrade` to upgrade your stack installation

This is the next error that I've run into, but this one is more straightforward. It might be good to put the stack version check at the start of installation rather than forcing the user to upgrade and restart just as it is finishing.

mrakgr commented 4 years ago
Cabal                            > [ 40 of 220] Compiling Distribution.Types.CondTree
basement                         > ghc.exe: getMBlocks: VirtualAlloc MEM_COMMIT failed: The paging file is too small for this operation to complete.
Cabal                            > [ 41 of 220] Compiling Distribution.Utils.Base62
Cabal                            > [ 42 of 220] Compiling Distribution.Utils.IOData
Cabal                            > [ 43 of 220] Compiling Distribution.Utils.MapAccum
Cabal                            > [ 44 of 220] Compiling Distribution.Utils.Progress
Cabal                            > [ 45 of 220] Compiling Distribution.Utils.String
Cabal                            > [ 46 of 220] Compiling Distribution.Utils.ShortText
cereal                           >
cereal                           > copy/register
cereal                           > Installing library in C:\Users\Marko\AppData\Roaming\stack\snapshots\a9a385c0\lib\x86_64-windows-ghc-8.6.4\cereal-0.5.8.0-GaBg9CPzXaNJC4BIy7cegv
cereal                           > Registering library for cereal-0.5.8.0..
Cabal                            > [ 47 of 220] Compiling Distribution.Utils.Generic
Cabal                            > [ 48 of 220] Compiling Distribution.Parsec.FieldLineStream
Cabal                            > [ 49 of 220] Compiling Distribution.Parsec.Class
Cabal                            > [ 50 of 220] Compiling Distribution.Text
Cabal                            > [ 51 of 220] Compiling Distribution.Types.Version
Cabal                            > [ 52 of 220] Compiling Distribution.Types.VersionRange
Cabal                            > [ 53 of 220] Compiling Distribution.Types.VersionInterval
Cabal                            > [ 54 of 220] Compiling Distribution.Types.SourceRepo
Cabal                            > [ 55 of 220] Compiling Distribution.Types.SourceRepo.Lens
Cabal                            > [ 56 of 220] Compiling Distribution.Types.PkgconfigName
Cabal                            > [ 57 of 220] Compiling Distribution.Types.ForeignLibType
Cabal                            > [ 58 of 220] Compiling Distribution.Types.ForeignLibOption
Cabal                            > [ 59 of 220] Compiling Distribution.Types.ExecutableScope
Cabal                            > [ 60 of 220] Compiling Distribution.Types.ComponentId
Cabal                            > [ 61 of 220] Compiling Distribution.Types.BuildType
Cabal                            > [ 62 of 220] Compiling Distribution.Types.AbiHash
Cabal                            > [ 63 of 220] Compiling Distribution.System
Cabal                            > [ 64 of 220] Compiling Distribution.SPDX.LicenseReference
Cabal                            > [ 65 of 220] Compiling Distribution.SPDX.LicenseId
Cabal                            > ghc.exe: getMBlocks: VirtualAlloc MEM_COMMIT failed: The paging file is too small for this operation to complete.

--  While building package Cabal-2.4.1.0 using:
      C:\Users\Marko\AppData\Roaming\stack\setup-exe-cache\x86_64-windows\Cabal-simple_Z6RU0evB_2.4.0.1_ghc-8.6.4.exe --builddir=.stack-work\dist\e626a42b build --ghc-options " -fdiagnostics-color=always"
    Process exited with code: ExitFailure 251

--  While building package basement-0.0.10 using:
      C:\Users\Marko\AppData\Roaming\stack\setup-exe-cache\x86_64-windows\Cabal-simple_Z6RU0evB_2.4.0.1_ghc-8.6.4.exe --builddir=.stack-work\dist\e626a42b build --ghc-options " -fdiagnostics-color=always"
    Process exited with code: ExitFailure 251

--  While building package cmdargs-0.10.20 using:
      C:\Users\Marko\AppData\Roaming\stack\setup-exe-cache\x86_64-windows\Cabal-simple_Z6RU0evB_2.4.0.1_ghc-8.6.4.exe --builddir=.stack-work\dist\e626a42b build --ghc-options " -fdiagnostics-color=always"
    Process exited with code: ExitFailure 251
Progress 14/101

It went past the previous point, but I am running into those memory allocation errors again. Note that it had some errors in the middle (that it skipped over) while compiling packages before finally giving up.

...Running it again runs into the same error. I am not sure if this is going to get installed at this rate.

For reference, my machine has 8Gb.

Is it not possible to provide the binaries directly on Windows? I am going to try it a few more tries and then give up if it does not work.

mrakgr commented 4 years ago

Every time I run the command it installs a few packages and then dies. I think I will just wait until the kinks for this have been worked out.

jneira commented 4 years ago

I dont experienced this in my windows machines (nor in the azure ci ones). have you tried to follow the recommendations in https://support.microsoft.com/en-au/help/4055223/memory-allocation-errors-can-be-caused-by-slow-page-file-growth?

I would suggest you to set the %STACK_ROOT% environment variable to D:\sr (or other short path) and, after a stack update add in %STACK_ROOT%\config.yaml:

local-bin-path: D:/bin # where stack put the executables with `stack install`, it should be in %PATH%
local-programs-path: D:/bin/stack # where stack will put the downloaded ghcs

In general try to keep directories of everything as short as possible, moreover if you dont have enabled the longs path option.

mrakgr commented 4 years ago
e:\Webdev\Purescript\hello>stack install language-javascript-0.7.0.0
Writing implicit global project config file to: E:\sr\global-project\stack.yaml
Note: You can change the snapshot via the resolver field there.
Using latest snapshot resolver: lts-15.3
Stack has not been tested with GHC versions above 8.6, and using 8.8.2, this may fail
Preparing to install GHC to an isolated location.
This will not interfere with any system-level installation.
ghc-8.8.2:   11.37 MiB / 377.61 MiB (  3.01%) downloaded...

I am concerned about that warning that it has not been tested with versions above 8.6. Is it fine that it is downloading 8.8.2? Whatever I did must have overwritten its default behavior.

Also, is it fine that I used E:\sr\bin as my bin directory? I think this part should be okay.

mrakgr commented 4 years ago

No, I just wasted over an hour of my time. Trying to build the Purs compiler just leads me back to those terminateProcess: permission denied (Permission denied) errors. I am not willing to play around with this anymore.

mrakgr commented 4 years ago

I mean in the sense of trying random things in hope that it starts working. I'd be willing to give it a try again if a serious fix comes out.

mrakgr commented 4 years ago

Changing my system locale from Japanese to US resolved my problem with installing language-javascript package. And I can confirm that the HIE installation is much more stable, but I still ran into the following error.

Cabal                            > Installing library in C:\Users\Marko\AppData\Roaming\stack\snapshots\44fa3e96\lib\x86_64-windows-ghc-8.6.5\Cabal-2.4.1.0-5rQrtDcYhR2LOcYye7obEr
Cabal                            > Registering library for Cabal-2.4.1.0..

--  While building package ghc-lib-parser-8.8.2.20200205 using:
      C:\Users\Marko\AppData\Roaming\stack\setup-exe-cache\x86_64-windows\Cabal-simple_Z6RU0evB_2.4.0.1_ghc-8.6.5.exe --builddir=.stack-work\dist\e626a42b build --ghc-options " -fdiagnostics-color=always"
    Process exited with code: ExitFailure 251

--  While building package attoparsec-0.13.2.3 using:
      C:\Users\Marko\AppData\Roaming\stack\setup-exe-cache\x86_64-windows\Cabal-simple_Z6RU0evB_2.4.0.1_ghc-8.6.5.exe --builddir=.stack-work\dist\e626a42b build --ghc-options " -fdiagnostics-color=always"
    Process exited with code: ExitFailure 251
Progress 99/229

I spied a memalloc error while the install was going on, but that did not cause the installation to crash. There is a good chance that if I continue going the install will succeed, but I want to move on.

As this is a stack issue I'll close this here.