{"action":"created","issue":{"url":"https://api.github.com/repos/commercialhaskell/stack/issues/2617","repository_url":"https://api.github.com/repos/commercialhaskell/stack","labels_url":"https://api.github.com/repos/commercialhaskell/stack/issues/2617/labels{/name}","comments_url":"https://api.github.com/repos/commercialhaskell/stack/issues/2617/comments","events_url":"https://api.github.com/repos/commercialhaskell/stack/issues/2617/events","html_url":"https://github.com/commercialhaskell/stack/issues/2617","id":178263197,"number":2617,"title":"Multiple writes at the same time on windows machine causes permission denied error","user":{"login":"hanjoosten","id":1159672,"avatar_url":"https://avatars.githubusercontent.com/u/1159672?v=3","gravatar_id":"","url":"https://api.github.com/users/hanjoosten","html_url":"https://github.com/hanjoosten","followers_url":"https://api.github.com/users/hanjoosten/followers","following_url":"https://api.github.com/users/hanjoosten/following{/other_user}","gists_url":"https://api.github.com/users/hanjoosten/gists{/gist_id}","starred_url":"https://api.github.com/users/hanjoosten/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hanjoosten/subscriptions","organizations_url":"https://api.github.com/users/hanjoosten/orgs","repos_url":"https://api.github.com/users/hanjoosten/repos","events_url":"https://api.github.com/users/hanjoosten/events{/privacy}","received_events_url":"https://api.github.com/users/hanjoosten/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-09-21T07:01:20Z","updated_at":"2016-09-26T00:01:30Z","closed_at":null,"body":"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. \r\n\r\nWhen I install my project, I get the following error message, when on of the many packages is being registered:\r\n\r\n````\r\nghc-pkg.EXE: C:\\sr\\snapshots\\480beed7\\pkgdb\\package.cache: you don't have permission to modify this file\r\n````\r\n\r\n### Diagnose\r\nThere are two things that catch my eye:\r\n 1. I wonder why anything is being written to a directory at C:\\sr . In my case, I have admin rights on my machine, but in a lot of companies, this isn't by default.\r\n 2. When I resubmit the command `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 to  `C:\\sr\\snapshots\\480beed7\\pkgdb\\package.cache` at the same time. This results in a write error in the latter process. \r\n\r\n \r\n### Steps to reproduce\r\n\r\n 1. clone a [large haskell program like the one I have these problems](https://github.com/AmpersandTarski/Ampersand/commit/9641c96cfc37232507cb1bf832a7372c276d1316)\r\n 2. build it on a multicore windows machine, using stack:\r\n     1. stack setup\r\n     2. stack install\r\n\r\n### Expected\r\n\r\nI would expect the build to succeed by only calling `stack install` once.\r\n\r\n### Actual\r\n\r\nDuring installation, I ran into the following error message:\r\n\r\n````\r\nProgress: 30/126\r\n--  While building package asn1-parse-0.9.4 using:\r\n      C:\\sr\\setup-exe-cache\\x86_64-windows\\setup-Simple-Cabal-1.24.0.0-ghc-8.0.1.exe --builddir=.stack-work\\dist\\b7fec021 register\r\n    Process exited with code: ExitFailure 1\r\n    Logs have been written to: D:\\data\\hjo20125\\Git\\Ampersand\\.stack-work\\logs\\asn1-parse-0.9.4.log\r\n\r\n    Configuring asn1-parse-0.9.4...\r\n    Building asn1-parse-0.9.4...\r\n    Preprocessing library asn1-parse-0.9.4...\r\n    [1 of 1] Compiling Data.ASN1.Parse  ( Data\\ASN1\\Parse.hs, .stack-work\\dist\\b7fec021\\build\\Data\\ASN1\\Parse.o )\r\n\r\n    Data\\ASN1\\Parse.hs:30:1: warning: [-Wunused-imports]\r\n        The import of `Control.Applicative' is redundant\r\n          except perhaps to import instances from `Control.Applicative'\r\n        To import instances alone, use: import Control.Applicative()\r\n    Installing library in\r\n    C:\\sr\\snapshots\\480beed7\\lib\\x86_64-windows-ghc-8.0.1\\asn1-parse-0.9.4-472aFk4Rjki87YeAg9g5Ph\r\n    Registering asn1-parse-0.9.4...\r\n    setup-Simple-Cabal-1.24.0.0-ghc-8.0.1.exe:\r\n    'C:\\Users\\hjo20125\\AppData\\Local\\Programs\\stack\\x86_64-windows\\ghc-8.0.1\\bin\\ghc-pkg.EXE'\r\n    exited with an error:\r\n    asn1-parse-0.9.4: Warning: haddock-interfaces:\r\n    C:\\sr\\snapshots\\480beed7\\doc\\asn1-parse-0.9.4\\asn1-parse.haddock doesn't exist\r\n    or isn't a file\r\n    ghc-pkg.EXE: C:\\sr\\snapshots\\480beed7\\pkgdb\\package.cache: you don't have\r\n    permission to modify this file\r\n\r\nD:\\data\\hjo20125\\Git\\Ampersand>\r\n````\r\nBecause 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.\r\n\r\n### Stack version\r\n\r\n```\r\n$ stack --version\r\nVersion 1.2.0, Git revision 123819b7d65df2ad7fe63fb5eb39a98536acb5f3 (4055 commits) x86_64 hpack-0.14.0\r\n```\r\n\r\n### Method of installation\r\n\r\n* Official binary, downloaded from stackage.org or fpcomplete's package repository\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/commercialhaskell/stack/issues/comments/249455250","html_url":"https://github.com/commercialhaskell/stack/issues/2617#issuecomment-249455250","issue_url":"https://api.github.com/repos/commercialhaskell/stack/issues/2617","id":249455250,"user":{"login":"mgsloan","id":22570,"avatar_url":"https://avatars.githubusercontent.com/u/22570?v=3","gravatar_id":"","url":"https://api.github.com/users/mgsloan","html_url":"https://github.com/mgsloan","followers_url":"https://api.github.com/users/mgsloan/followers","following_url":"https://api.github.com/users/mgsloan/following{/other_user}","gists_url":"https://api.github.com/users/mgsloan/gists{/gist_id}","starred_url":"https://api.github.com/users/mgsloan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mgsloan/subscriptions","organizations_url":"https://api.github.com/users/mgsloan/orgs","repos_url":"https://api.github.com/users/mgsloan/repos","events_url":"https://api.github.com/users/mgsloan/events{/privacy}","received_events_url":"https://api.github.com/users/mgsloan/received_events","type":"User","site_admin":false},"created_at":"2016-09-26T00:01:30Z","updated_at":"2016-09-26T00:01:30Z","body":"> I wonder why anything is being written to a directory at C:\\sr . In my case, I have admin rights on my machine, but in a lot of companies, this isn't by default.\r\n\r\nThis is customizable via the STACK_ROOT environment variable.  This is described in [the docs](https://readthedocs.org/search/?q=STACK_ROOT&check_keywords=yes&area=default&project=stack&version=stable&type=file).\r\n\r\n> When I resubmit the command 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 to C:\\sr\\snapshots\\480beed7\\pkgdb\\package.cache at the same time. This results in a write error in the latter process.\r\n\r\nWe 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."}}
{"actor":{"display_login":"mgsloan"}}