Restore task fails in an multi user scenario #3897

Closed
blackdwarf opened this Issue Nov 8, 2016 · 4 comments

Comments

Projects
None yet
3 participants
@blackdwarf

blackdwarf commented Nov 8, 2016

Steps to reproduce

  • Have an Ubuntu OS (tried on 16.04)
  • Create two users
  • Log in as one and drop a new project and restore
  • Log out and then log in as the other user
  • Try to do the same thing

Expected result

Restore succeeds and all is well.

Actual result

The task fails with the following trace:

/opt/dotnet/sdk/1.0.0-preview3-004056/NuGet.targets(70,5): error MSB4018: The "RestoreTask" task failed unexpectedly. [/home/ux2/hwapp/hwapp.csproj]
/opt/dotnet/sdk/1.0.0-preview3-004056/NuGet.targets(70,5): error MSB4018: System.InvalidOperationException: Unable to obtain lock file access on '/tmp/NuGetScratch/lock/579baa38a3fa97511aa5dad3c57f3d83067b02d7' for operations on '/home/ux2/.nuget/NuGet/NuGet.Config'. This may mean that a different user or administator is holding this lock and that this process does not have permission to access it. If no other process is currently performing an operation on this file it may mean that an earlier NuGet process crashed and left an inaccessible lock file, in this case removing the file '/tmp/NuGetScratch/lock/579baa38a3fa97511aa5dad3c57f3d83067b02d7' will allow NuGet to continue. [/home/ux2/hwapp/hwapp.csproj]
/opt/dotnet/sdk/1.0.0-preview3-004056/NuGet.targets(70,5): error MSB4018:    at NuGet.Common.ConcurrencyUtilities.ExecuteWithFileLocked(String filePath, Action action) [/home/ux2/hwapp/hwapp.csproj]
/opt/dotnet/sdk/1.0.0-preview3-004056/NuGet.targets(70,5): error MSB4018:    at NuGet.Configuration.Settings.ExecuteSynchronized(Action ioOperation) [/home/ux2/hwapp/hwapp.csproj]
/opt/dotnet/sdk/1.0.0-preview3-004056/NuGet.targets(70,5): error MSB4018:    at NuGet.Configuration.Settings..ctor(String root, String fileName, Boolean isMachineWideSettings) [/home/ux2/hwapp/hwapp.csproj]
/opt/dotnet/sdk/1.0.0-preview3-004056/NuGet.targets(70,5): error MSB4018:    at NuGet.Configuration.Settings.ReadSettings(String root, String settingsPath, Boolean isMachineWideSettings) [/home/ux2/hwapp/hwapp.csproj]
/opt/dotnet/sdk/1.0.0-preview3-004056/NuGet.targets(70,5): error MSB4018:    at NuGet.Configuration.Settings.LoadUserSpecificSettings(List`1 validSettingFiles, String root, String configFileName, IMachineWideSettings machineWideSettings, Boolean useTestingGlobalPath) [/home/ux2/hwapp/hwapp.csproj]
/opt/dotnet/sdk/1.0.0-preview3-004056/NuGet.targets(70,5): error MSB4018:    at NuGet.Configuration.Settings.LoadDefaultSettings(String root, String configFileName, IMachineWideSettings machineWideSettings, Boolean loadAppDataSettings, Boolean useTestingGlobalPath) [/home/ux2/hwapp/hwapp.csproj]
/opt/dotnet/sdk/1.0.0-preview3-004056/NuGet.targets(70,5): error MSB4018:    at NuGet.Configuration.Settings.LoadDefaultSettings(String root, String configFileName, IMachineWideSettings machineWideSettings) [/home/ux2/hwapp/hwapp.csproj]
/opt/dotnet/sdk/1.0.0-preview3-004056/NuGet.targets(70,5): error MSB4018:    at NuGet.Build.Tasks.RestoreTask.Execute() [/home/ux2/hwapp/hwapp.csproj]
/opt/dotnet/sdk/1.0.0-preview3-004056/NuGet.targets(70,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [/home/ux2/hwapp/hwapp.csproj]
/opt/dotnet/sdk/1.0.0-preview3-004056/NuGet.targets(70,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__25.MoveNext() [/home/ux2/hwapp/hwapp.csproj]

The version of the CLI being used is 1.0.0-preview4-004056.

/cc @yishaigalatzer @rrelyea @joelverhagen

@joelverhagen

This comment has been minimized.

Show comment
Hide comment
@joelverhagen

joelverhagen Nov 8, 2016

Member

We need the lock files to be placed in a user scoped directory or a directory that all users have write access to.

Member

joelverhagen commented Nov 8, 2016

We need the lock files to be placed in a user scoped directory or a directory that all users have write access to.

@joelverhagen joelverhagen added this to the 4.0 RC2 milestone Nov 8, 2016

@joelverhagen

This comment has been minimized.

Show comment
Hide comment
@joelverhagen

joelverhagen Nov 8, 2016

Member

@blackdwarf, what are the two usernames (and home directories, if not default) in question here? Are you running into this problem or has this been encountered "in the wild"? Is either command running under sudo? Could you provide the ls -l PATH of the lock file and the NuGet.config file in question?

Member

joelverhagen commented Nov 8, 2016

@blackdwarf, what are the two usernames (and home directories, if not default) in question here? Are you running into this problem or has this been encountered "in the wild"? Is either command running under sudo? Could you provide the ls -l PATH of the lock file and the NuGet.config file in question?

@joelverhagen

This comment has been minimized.

Show comment
Hide comment
@joelverhagen

joelverhagen Nov 8, 2016

Member

Workaround

chmod 777 /tmp/NuGetScratch/lock
Member

joelverhagen commented Nov 8, 2016

Workaround

chmod 777 /tmp/NuGetScratch/lock
@joelverhagen

This comment has been minimized.

Show comment
Hide comment
Member

joelverhagen commented Jan 6, 2017

Fixed with NuGet/NuGet.Client#1035. Thanks @tmds!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment