You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cmd/go: 'Access is denied' when renaming module cache directory #36568
changed the title [-]Cannot rename dependency mod from name@version.tmp-xxx to name@version[/-][+]Cannot build: when rename dependency mod from name@version.tmp-xxx to name@version, fail[/+]on Jan 15, 2020
changed the title [-]Cannot build: when rename dependency mod from name@version.tmp-xxx to name@version, fail[/-][+]cmd/go: Cannot build: when rename dependency mod from name@version.tmp-xxx to name@version, fail[/+]on Jan 15, 2020
changed the title [-]cmd/go: Cannot build: when rename dependency mod from name@version.tmp-xxx to name@version, fail[/-][+]cmd/go: cannot build when rename dependency mod from name@version.tmp-xxx to name@version[/+]on Jan 16, 2020
Could you post a listing of the directory C:\Users\502380\go\pkg\mod\golang.org\x\?
Are you able to reproduce this or did it just happen once? How about after clearing the module cache with go clean -modcache?
Reacted by Luis Gabriel Gomez, Samuel Hawksby-Robinson and Felix ツ
@cagedmantis@jayconrod I am doing go build with module using Jetbrain Goland, some how command prompt also able to produce the error.
Note that my application contain a lot of dependency, and i need to rerun > go build , sometime it success, sometime it will fail with error message below ( depend on the package, some package will have issue, then I run go build again, no more issue/)
Here is the error when running in command prompt using go get, but actually the error is same ( except go build is loading a lot of dependency compare to go get below, but github.com/go-playground/locales is the one that always fail )
So the only possibilities I can see for this failure are:
A bug in our lockedfile.Mutex or os.Rename implementation is causing the file-locks to not actually synchronize the other I/O operations.
Something (perhaps Goland, or perhaps an antivirus scanner?) is accessing one or both of the directories to be renamed without holding the associated file lock.
A bug in the Windows kernel or filesystem implementation is causing the file-locks to not actually synchronize the other I/O operations.
Of course, it is also possible that I have missed something.
For cause (1), we should fix our implementation.
For cause (2) or (3), we should ensure that a bug is filed against the appropriate other project, and then we could perhaps use robustio.Rename instead of os.Rename if we believe that will help. However, I would want some way to empirically reproduce and measure the problem and the mitigation to verify that it actually does help.
@kiwionly do u use Ubuntu 18.04 on windows 10 ?
do u use Mcafee Endpoint Security ?
if so just search and find ubuntu1804.exe in your system
then right click ubuntu1804.exe-> properties -> compatibility(second tab) -> Setting(select run as administration ) ,then click Application (A) , all is ok ;
if it still build fail ,please click security tab , and click Advaced(V)
make sure your account access has Complete control ,default all allow is TrustedInstaller user ,this will prevented by Mcafee ;
wish it helped all who met this err ,I had troubled by it for months ;
@kiwionly do u use Ubuntu 18.04 on windows 10 ?
do u use Mcafee Endpoint Security ?
if so just search and find ubuntu1804.exe in your system
then right click ubuntu1804.exe-> properties -> compatibility(second tab) -> Setting(select run as administration ) ,then click Application (A) , all is ok ;
if it still build fail ,please click security tab , and click Advaced(V)
make sure your account access has Complete control ,default all allow is TrustedInstaller user ,this will prevented by Mcafee ;
wish it helped all who met this err ,I had troubled by it for months ;
@herohenu I build GO on window 10 with McAfee, unfortunately I no admin right to change any settings.
Activity
[-]Cannot rename dependency mod from name@version.tmp-xxx to name@version[/-][+]Cannot build: when rename dependency mod from name@version.tmp-xxx to name@version, fail[/+][-]Cannot build: when rename dependency mod from name@version.tmp-xxx to name@version, fail[/-][+]cmd/go: Cannot build: when rename dependency mod from name@version.tmp-xxx to name@version, fail[/+][-]cmd/go: Cannot build: when rename dependency mod from name@version.tmp-xxx to name@version, fail[/-][+]cmd/go: cannot build when rename dependency mod from name@version.tmp-xxx to name@version[/+]cagedmantis commentedon Jan 16, 2020
@kiwionly Could you provide an example of the code that produced the error, preferably as a Go playground link?
jayconrod commentedon Jan 16, 2020
Seems like the same issue as microsoft/vscode-go#2897. We've never been able to reproduce this.
Could you post a listing of the directory
C:\Users\502380\go\pkg\mod\golang.org\x\?Are you able to reproduce this or did it just happen once? How about after clearing the module cache with
go clean -modcache?[-]cmd/go: cannot build when rename dependency mod from name@version.tmp-xxx to name@version[/-][+]cmd/go: '[/+][-]cmd/go: '[/-][+]cmd/go: 'Access is denied' when renaming module cache directory[/+]kiwionly commentedon Jan 17, 2020
@cagedmantis @jayconrod I am doing go build with module using Jetbrain Goland, some how command prompt also able to produce the error.
Note that my application contain a lot of dependency, and i need to rerun > go build , sometime it success, sometime it will fail with error message below ( depend on the package, some package will have issue, then I run go build again, no more issue/)
Here is the error when running in command prompt using go get, but actually the error is same ( except go build is loading a lot of dependency compare to go get below, but github.com/go-playground/locales is the one that always fail )
bcmills commentedon Jan 22, 2020
For the
renameof that directory, we use a separate lockfile:go/src/cmd/go/internal/modfetch/fetch.go
Line 76 in 6718cb6
go/src/cmd/go/internal/modfetch/fetch.go
Lines 82 to 83 in 6718cb6
go/src/cmd/go/internal/modfetch/fetch.go
Line 122 in 6718cb6
So the only possibilities I can see for this failure are:
lockedfile.Mutexoros.Renameimplementation is causing the file-locks to not actually synchronize the other I/O operations.Of course, it is also possible that I have missed something.
For cause (1), we should fix our implementation.
For cause (2) or (3), we should ensure that a bug is filed against the appropriate other project, and then we could perhaps use
robustio.Renameinstead ofos.Renameif we believe that will help. However, I would want some way to empirically reproduce and measure the problem and the mitigation to verify that it actually does help.CC @jstarks @alexbrainman @zx2c4 @networkimprov in case they have any insights into how to debug this.
86 remaining items
herohenu commentedon Jun 30, 2020
@kiwionly do u use Ubuntu 18.04 on windows 10 ?
do u use Mcafee Endpoint Security ?
if so just search and find ubuntu1804.exe in your system
then right click ubuntu1804.exe-> properties -> compatibility(second tab) -> Setting(select run as administration ) ,then click Application (A) , all is ok ;
if it still build fail ,please click security tab , and click Advaced(V)
make sure your account access has Complete control ,default all allow is TrustedInstaller user ,this will prevented by Mcafee ;
wish it helped all who met this err ,I had troubled by it for months ;
kiwionly commentedon Jul 1, 2020
@herohenu I build GO on window 10 with McAfee, unfortunately I no admin right to change any settings.
Anyway, thx for your remind.
SelfDrivingCarp commentedon Aug 26, 2020
Also hit this issue:
go version go1.15 linux/amd64rm -rf ~/go/*but that didn't helpGODEBUG=modcacheunzipinplace=1 go mod tidyFor fellow McAfee sufferers, this vague page may be related: https://kc.mcafee.com/corporate/index?page=content&id=KB91411
gopherbot commentedon Oct 1, 2020
Change https://golang.org/cl/258798 mentions this issue:
cmd/go/internal/modfetch: always extract module directories in placeegodigitus commentedon Jan 27, 2021
Is the fix from https://golang.org/cl/258798 part of release go1.16beta1 ?
bcmills commentedon Jan 27, 2021
@egodigitus, yes, that change is included in
go1.16beta1.egodigitus commentedon Jan 27, 2021
go1.16beta1fixed the bug for me 👍OS: Windows 10
Running golang inside WSL Ubuntu 20.04
cmd/go/internal/modfetch: always extract module directories in place