Skip to content
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

stack update gives "fdLock: invalid argument (Invalid argument)" #5589

Closed
simonmichael opened this issue Jul 19, 2021 · 5 comments
Closed

stack update gives "fdLock: invalid argument (Invalid argument)" #5589

simonmichael opened this issue Jul 19, 2021 · 5 comments

Comments

@simonmichael
Copy link
Contributor

simonmichael commented Jul 19, 2021

On a VPS I notice current stack giving this error for update and other commands (build, install). Even wiping ~/.stack didn't help:

~$ rm -rf .stack
~$ stack update
Selected mirror https://hackage.haskell.org/
Downloading root
Waiting to acquire cache lock on /home/simon/.stack/pantry/hackage/hackage-security-lock
fdLock: invalid argument (Invalid argument)
~$ uname -a
Linux joyful.com 5.12.2-x86_64-linode144 #1 SMP Mon May 10 13:10:23 EDT 2021 x86_64 x86_64 x86_64 GNU/Linux
~$ arch
x86_64
~$ stack --version
Version 2.7.1 i386
Compiled with:
- Cabal-3.2.1.0
- Glob-0.10.1
- StateVar-1.2.1
- aeson-1.5.6.0
- annotated-wl-pprint-0.7.0
- ansi-terminal-0.10.3
- ansi-wl-pprint-0.6.9
- array-0.5.4.0
- asn1-encoding-0.9.6
- asn1-parse-0.9.5
- asn1-types-0.3.4
- assoc-1.0.2
- async-2.2.3
- attoparsec-0.13.2.5
- attoparsec-iso8601-1.0.2.0
- auto-update-0.1.6
- base-4.14.1.0
- base-compat-0.11.2
- base-compat-batteries-0.11.2
- base-orphans-0.8.4
- base16-bytestring-0.1.1.7
- base64-bytestring-1.1.0.0
- basement-0.0.11
- bifunctors-5.5.10
- binary-0.8.8.0
- blaze-builder-0.4.2.1
- blaze-html-0.9.1.2
- blaze-markup-0.8.2.8
- bytestring-0.10.12.0
- casa-client-0.0.1
- casa-types-0.0.1
- case-insensitive-1.2.1.0
- cereal-0.5.8.1
- clock-0.8
- colour-2.3.5
- comonad-5.0.8
- conduit-1.3.4.1
- conduit-combinators-1.3.0
- conduit-extra-1.3.5
- connection-0.3.1
- constraints-0.12
- containers-0.6.2.1
- contravariant-1.5.3
- cookie-0.4.5
- cryptohash-sha256-0.11.102.0
- cryptonite-0.27
- cryptonite-conduit-0.2.2
- data-default-class-0.1.2.0
- data-fix-0.3.1
- deepseq-1.4.4.0
- digest-0.0.1.2
- directory-1.3.6.0
- distributive-0.6.2.1
- dlist-0.8.0.8
- easy-file-0.2.2
- echo-0.1.4
- ed25519-0.0.5.0
- either-5.0.1.1
- enclosed-exceptions-1.0.3
- exceptions-0.10.4
- extra-1.7.9
- fast-logger-3.0.3
- file-embed-0.0.13.0
- filelock-0.1.1.5
- filepath-1.4.2.1
- filtrable-0.1.4.0
- fsnotify-0.3.0.1
- generic-deriving-1.13.1
- ghc-boot-th-8.10.4
- ghc-prim-0.6.1
- githash-0.1.5.0
- hackage-security-0.6.0.1
- hashable-1.3.0.0
- hi-file-parser-0.1.2.0
- hinotify-0.4.1
- hourglass-0.2.12
- hpack-0.34.4
- hpc-0.6.1.0
- http-api-data-0.4.1.1
- http-client-0.6.4.1
- http-client-tls-0.3.5.3
- http-conduit-2.3.8
- http-download-0.2.0.0
- http-types-0.12.3
- indexed-traversable-0.1.1
- infer-license-0.2.0
- integer-gmp-1.0.3.0
- integer-logarithms-1.0.3.1
- libyaml-0.1.2
- lifted-async-0.10.2
- lifted-base-0.2.3.12
- lukko-0.1.1.3
- megaparsec-9.0.1
- memory-0.15.0
- microlens-0.4.11.2
- microlens-mtl-0.2.0.1
- microlens-th-0.4.3.9
- mime-types-0.1.0.9
- mintty-0.1.2
- monad-control-1.0.2.3
- monad-logger-0.3.36
- monad-loops-0.4.3
- mono-traversable-1.0.15.1
- mtl-2.2.2
- mustache-2.3.1
- neat-interpolation-0.5.1.2
- network-3.1.1.1
- network-uri-2.6.4.1
- old-locale-1.0.0.7
- old-time-1.1.0.3
- open-browser-0.2.1.0
- optparse-applicative-0.15.1.0
- optparse-simple-0.1.1.3
- pantry-0.5.1.5
- parsec-3.1.14.0
- parser-combinators-1.2.1
- path-0.7.0
- path-io-1.6.2
- path-pieces-0.2.1
- pem-0.2.4
- persistent-2.11.0.4
- persistent-sqlite-2.11.1.0
- persistent-template-2.9.1.0
- pretty-1.1.3.6
- primitive-0.7.1.0
- process-1.6.9.0
- profunctors-5.5.2
- project-template-0.2.1.0
- random-1.1
- regex-applicative-0.3.4
- regex-applicative-text-0.1.0.1
- resource-pool-0.2.3.2
- resourcet-1.2.4.2
- retry-0.8.1.2
- rio-0.1.20.0
- rio-orphans-0.1.2.0
- rio-prettyprint-0.1.1.0
- rts-1.0
- safe-0.3.19
- safe-exceptions-0.1.7.1
- scientific-0.3.6.2
- semigroupoids-5.3.5
- semigroups-0.19.1
- shelly-1.9.0
- silently-1.2.5.1
- socks-0.6.1
- split-0.2.3.4
- stm-2.5.0.0
- stm-chans-3.0.0.4
- streaming-commons-0.2.2.1
- strict-0.4.0.1
- syb-0.7.2.1
- tagged-0.8.6.1
- tar-0.5.1.1
- tar-conduit-0.3.2
- template-haskell-2.16.0.0
- temporary-1.3
- text-1.2.4.1
- text-metrics-0.3.0
- th-abstraction-0.4.2.0
- th-compat-0.1.2
- th-expand-syns-0.4.8.0
- th-lift-0.8.2
- th-lift-instances-0.1.18
- th-reify-many-0.1.9
- these-1.1.1.1
- time-1.9.3
- time-compat-1.9.5
- tls-1.5.5
- transformers-0.5.6.2
- transformers-base-0.4.5.2
- transformers-compat-0.6.6
- type-equality-1
- typed-process-0.2.6.0
- unicode-transforms-0.3.7.1
- unix-2.7.2.2
- unix-compat-0.5.3
- unix-time-0.4.7
- unliftio-0.2.14
- unliftio-core-0.2.0.1
- unordered-containers-0.2.13.0
- uuid-types-1.0.4
- vector-0.12.1.2
- vector-algorithms-0.8.0.4
- x509-1.7.5
- x509-store-1.6.7
- x509-system-1.6.6
- x509-validation-1.6.11
- yaml-0.11.5.0
- zip-archive-0.4.1
- zlib-0.6.2.3

Warning: this is an unsupported build that may use different versions of
dependencies and GHC than the officially released binaries, and therefore may
not behave identically.  If you encounter problems, please try the latest
official build by running 'stack upgrade --force-download'.

Is it just me ? This machine is unusual, after upgrades it is a mixture of 32 bit libs/64 bit kernel, or vice versa.

Possibly related discussion at:
haskell/cabal#6602
haskellari/lukko#15
haskell/cabal#7442
haskell/cabal#7313

Indeed, it seems like it might be 32-bit related.

@simonmichael
Copy link
Contributor Author

And I guess that's why stack on this machine is an "unsupported version":

~$ stack upgrade --force-download
Current Stack version: 2.7.1, available download version: 2.7.1
Forcing binary upgrade
Querying for archive location for platform: linux-i386-static
Querying for archive location for platform: linux-i386

Warning: Exception occured when trying to perform binary upgrade:
         UnliftIO.Exception.throwString called with:

Unable to find binary Stack archive for platforms: linux-i386-static linux-i386
Called from:
  throwString (src/Stack/Setup.hs:1845:21 in stack-2.7.1-ImqxtVS4FFaHoYBxQFsFAz:Stack.Setup)


         Falling back to source upgrade
Updating index to make sure we find the latest Stack version
Selected mirror https://hackage.haskell.org/
Downloading root
Waiting to acquire cache lock on /home/simon/.stack/pantry/hackage/hackage-security-lock
fdLock: invalid argument (Invalid argument)

I think this started with 2.7.x.

@hasufell
Copy link
Contributor

@simonmichael how did you even manage to get a 32bit stack?

@simonmichael
Copy link
Contributor Author

Built it on that machine with an existing stack executable, I think.

@hasufell
Copy link
Contributor

@simonmichael well, there are no 32bit release binaries, so I'm not surprised it doesn't work. You could try stack upgrade --binary-platform linux-x86_64-static --force-download

@simonmichael
Copy link
Contributor Author

Fantastic, thanks! Your suggestion to add --binary-platform linux-x86_64-static fixed it:

$ stack --version
Version 2.7.3 i386
...
Warning: this is an unsupported build that may use different versions of
dependencies and GHC than the officially released binaries, and therefore may
not behave identically.  If you encounter problems, please try the latest
official build by running 'stack upgrade --force-download'.

$ stack upgrade --binary-platform linux-x86_64-static --force-download
Current Stack version: 2.7.3, available download version: 2.7.3
Forcing binary upgrade
Querying for archive location for platform: linux-x86_64-static
Downloading from: https://github.com/commercialhaskell/stack/releases/download/v2.7.3/stack-2.7.3-linux-x86_64-static.tar.gz
Download complete, testing executable
Version 2.7.3, Git revision 7927a3aec32e2b2e5e4fb5be76d0d50eddcc197f x86_64 hpack-0.34.4
New stack executable available at /home/simon/.local/bin/stack
$ stack --version
Version 2.7.3, Git revision 7927a3aec32e2b2e5e4fb5be76d0d50eddcc197f x86_64 hpack-0.34.4
$ stack update
Selected mirror https://hackage.haskell.org/
Downloading root
Waiting to acquire cache lock on /home/simon/.stack/pantry/hackage/hackage-security-lock
Acquired cache lock on /home/simon/.stack/pantry/hackage/hackage-security-lock
Released cache lock on /home/simon/.stack/pantry/hackage/hackage-security-lock
Selected mirror https://hackage.haskell.org/
Downloading timestamp
Downloading snapshot
Downloading mirrors
Cannot update index (no local copy)
Downloading index
Waiting to acquire cache lock on /home/simon/.stack/pantry/hackage/hackage-security-lock
Acquired cache lock on /home/simon/.stack/pantry/hackage/hackage-security-lock
Released cache lock on /home/simon/.stack/pantry/hackage/hackage-security-lock
Updated package index downloaded
Calculating hashes to check for hackage-security rebases or filesystem changes
No old cache found, populating cache from scratch
Populating cache from file size 749300224, hash a934a0a7cc6e481a4c3d59e82cee1a2fef3a6ccac0a211b4d768f3b281dc9769
Populating package index cache ...
Package index cache populated

I guess on this system it was auto-selecting the 32 bit binary, which worked less well. Perhaps there's room for improvement in that choice ? If not, this can be closed.

hraftery added a commit to balena-io-examples/balena-haskell-hello-world that referenced this issue Nov 7, 2022
- Pinned ghcup to version 0.1.17.8 since by default it auto-updates and 0.1.18.0 is broken on ARM: https://gitlab.haskell.org/haskell/ghcup-hs/-/issues/405
- Investigated complex "fdlock: invalid argument" bug (commercialhaskell/stack#5589) but couldn't reliably eliminate it. Updating to stack 2.9.1 may help, but seems to be okay now with the original 2.7.5 so leaving it be.
- Made reason for ENV commands for ghcup more explicit for future maintainers.
- Split prerequisite installs from ghcup installs for better caching and easier maintenance.
- Renamed ARGs for more self-documentation, and moved them closer to where they're used since they're applied at each RUN and therefore affect caching.
- Removed redundant `--copy-bins` flag.
- Removed stack.yaml.lock because it's not used and at the moment does not provide any useful locking.
- Changed "Cabal-version" requirement to >=1.8 from >1.2 to remove warning about unsupported version range syntax feature, since we have no reason to support the very outdated <1.8.

Change-type: patch
Signed-off-by: Heath Raftery (@hraftery) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants