-
Notifications
You must be signed in to change notification settings - Fork 842
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
Multiple writes at the same time on windows machine causes permission denied error #2617
Comments
For what it is worth: The result can be observed from Appveyor too. |
This is customizable via the STACK_ROOT environment variable. This is described in the docs.
We have not seen such problems with concurrent writing of that. Perhaps it is only an issue on windows? Seems worth investigation. At least multiple builds eventually succeed. I assume the problem persists even if you delete the stack root and start fresh? |
I had the variable STACK_ROOT defined before I did the fresh install. I assume that there is no existence check before it is set. Before it installed, it pointed to D:\stackroot\ After installation, it pointed to c:\sr The Ampersand project uses 100+ packages (transitive). Other team members with Windows machines experienced the same problem. Fortunately the workaround is to just issue the command When I delete stackroot and start fresh, the issue persists indeed. Having to re-issue the command 2 to 3 times seems standard. |
If there is anything I can do to help (testing?), just let me know. |
I've split off an issue for the installer issue - #2638 We don't have other issues like this from windows users, so my theory is that your code base (or particular dependencies) do something unusual which is triggering this condition. If you could construct a case that reproduces, that would be very helpful. One approach might be to trim down your project to just a cabal file + stack file, rename it, and post it up. |
Yesterday I installed ghc-mod, because I want to try atom as an editor. So I issued the command |
Cool! I will try next time I'm on a windows box. |
I'm experiencing the same problem (any package with lots of dependencies, like |
haskell/cabal#4005 might be related. |
I'm seeing this in most of my appveyor builds of hledger, since switching them to GHC 8 I think. Eg: https://ci.appveyor.com/project/simonmichael/hledger/build/master-85. |
I'm experiencing the same issue on Windows x64. This occurs whenever you use The temporary fix is to use |
I looked a bit closer around haddock phase building, but couldn't find anything obvious. |
Is someone available to look into this issue (paid)? domen@enlambda.com |
The root cause is likely to be that |
@ndmitchell so this is actually a stack issue, looking at |
@domenkozar perhaps, perhaps not. |
Oh, @ndmitchell, that's an interesting claim. Is a concurrent read-write really not possible on Windows? It will be hard for us to fix this, because when we shell out to GHC, GHC will read from the package database; we'd have to block ALL calls to GHC before running a ghc-pkg register. |
It is possible on Windows, but the Haskell file handle functions deliberately chose to pass the flags explicitly requesting that you deny sharing. I reported this ~10 years ago to GHC, but can't find where I did so (the Linux functions pass different sharing flags). |
For future reference, until this is fixed: See workaround in input-output-hk/cardano-sl@61470aa |
See haskell/cabal#4005 (comment) for further development on this issue. |
The proper fix went into ghc-pkg and will be available in GHC 8.2.1 (see https://phabricator.haskell.org/rGHC0d86aa5904e5a06c93632357122e57e4e118fd2a for more details). However, this still needs to be fixed in stack for older GHC versions. As pointed out in haskell/cabal#4005 (comment), we need to acquire global read/write lock while interacting with a specific package database, where configure/build phase is treated as a reader and install/register phase as a writer. This will unfortunately limit overall build parallelism, so I presume it should be only done on Windows. The idea is to port GHC.IO.Handle.Lock from base-4.10.0.0 and acquire appropriate lock on a specific file within STACK_ROOT during each build phase. I'll be providing PR that solves this. I'm not overly familiar with stack source code, so any pointers for what part of the code I should focus on would be welcome. |
We've lived with this problem a really long time. It's great the fix is available upstream, but is it worth just waiting for GHC 8.2, rather than fixing stack? |
@ndmitchell Well, it could be argued that people who won't/can't use 8.2 will not benefit from the fix. Although the problem can be worked around , it is pretty annoying. |
I will be happy to wait for ghc 8.2 to land for the fix, and happy for stack not to do anything about this |
This is a potential workaround for commercialhaskell/stack#2617.
As I see "need repro" label for that issue - it is easily reproducable - try to build Stack itself with stack build on clean caches. |
Can anyone confirm whether GHC 8.2.1 fixes this? |
@borsboom It does. |
Alright, closing this issue as resolved upstream. |
Appveyor failed on latest release https://ci.appveyor.com/project/begriffs/postgrest/build/1.0.5 according to commercialhaskell/stack#2617 (comment) this can be fixed by adding `-j1`.
Appveyor failed on latest release https://ci.appveyor.com/project/begriffs/postgrest/build/1.0.5 according to commercialhaskell/stack#2617 (comment) this can be fixed by adding `-j1`.
Note: passing the |
Appveyor failed on latest release https://ci.appveyor.com/project/begriffs/postgrest/build/1.0.5 according to commercialhaskell/stack#2617 (comment) this can be fixed by adding `-j1`.
On my windows 7 machine, I tried to build my project with LTS-7.0 This failed for some reason. Evantually, I removed ALL previously installed haskell / ghc / cabal / stack stuff from my machine, making sure I could do a totally clean installation.
When I install my project, I get the following error message, when on of the many packages is being registered:
Diagnose
There are two things that catch my eye:
stack install
, the list of packages being built is growing. However, sometime further it can happen again. I guess that there are multiple processes trying to write toC:\sr\snapshots\480beed7\pkgdb\package.cache
at the same time. This results in a write error in the latter process.Steps to reproduce
Expected
I would expect the build to succeed by only calling
stack install
once.Actual
During installation, I ran into the following error message:
Because of the fact that there seems to be a write conflict, I tried to re-run
stack install
each time that this error occurs. Every time, some more packages are registered, and eventually my application is build succesfully.Stack version
Method of installation
The text was updated successfully, but these errors were encountered: