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

nuget can't list packages in Artifactory source/repo from linux - timeout #7206

Closed
chrishiestand opened this issue Aug 15, 2018 · 15 comments
Closed
Labels
Platform:Xplat Resolution:External This issue appears to be External to nuget

Comments

@chrishiestand
Copy link

chrishiestand commented Aug 15, 2018

Details about Problem

The big goal is to be able to dotnet restore using nuget packabges from a private artifactory repository, all inside a linux container. However I cannot get packages or list repository contents from the linux container using dotnet or nuget.

NuGet product used: nuget.exe
NuGet version: 4.7.1.5393
dotnet.exe --version: 2.1.302
VS version: n/a
OS version: Linux 4.9.93-linuxkit-aufs, Docker container based on Debian Stretch microsoft/dotnet:2.1-sdk
mono version: Debian 4.6.2.7+dfsg-1

Worked before? I have never attempted it before from the linux cli. However I can list the repository contents just fine from visual studio (on Mac or Windows).

Detailed repro steps so we can see the same problem

  1. Run the container docker run -it microsoft/dotnet:2.1-sdk /bin/bash

  2. Install nuget and mono:

apt-get update && \
env DEBIAN_FRONTEND=noninteractive apt-get install -yy \
    mono-complete \
    curl \
    vim && \
curl -o /usr/local/bin/nuget.exe https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
  1. Add the artifactory repository (we are using hosted artifactory):
mono /usr/local/bin/nuget.exe sources Add -Name Artifactory -Source https://myorg.jfrog.io/myorg/api/nuget/nuget-local -username myuser -password mypassword
  1. Verify the artifactory source is displayed along with nuget.org:
mono /usr/local/bin/nuget.exe sources list

Registered Sources:

  1. nuget.org [Enabled]
    https://api.nuget.org/v3/index.json
  2. Artifactory [Enabled]
    https://myorg.jfrog.io/myorg/api/nuget/nuget-local
  1. See that the nuget.org repository works:
mono /usr/local/bin/nuget.exe list -Source nuget.org

bang.test.bench 0.1.0
DeveloperInTheFlow.Nini 1.1.0.1
libpxcclr.cs 10.0.26.400
PBKDFPassworrdHash 1.0.0.2
HashFoo.MigratorFoo 0.5.4623.19419
...

  1. See that listing the artifactory repository hangs:
mono /usr/local/bin/nuget.exe list -Source Artifactory -Verbosity detailed

NuGet Version: 4.7.1.5393
[hang]
Unable to load the service index for source https://myorg.jfrog.io/myorg/api/nuget/nuget-local.
The HTTP request to 'GET https://myorg.jfrog.io/myorg/api/nuget/nuget-local' has timed out after 100000ms.
[stacktrace below]

  1. See that curling the repo works fine (so the http connection is actually working fine). Also connecting to the repo works from Visual Studio.
curl -u "myuser:mypass" https://myorg.jfrog.io/myorg/api/nuget/nuget-local
Default Packages

Other suggested things

Artifactory doesn't say whether the repo is v2 or v3. So I tried configurations for both. In the v3 configuration you put this into your nuget config:

<add key="ArtifactoryNuGetV3" value="https://myorg.jfrog.io/myorg/api/nuget/v3/nuget-local" protocolVersion="3" />

And then add auth:

nuget setapikey myuser:mykey -Source ArtifactoryNuGetV3

Listing the source causes the same hang:

mono /usr/local/bin/nuget.exe list -Source ArtifactoryNuGetV3 -Verbosity detailed

NuGet Version: 4.7.1.5393
Unable to load the service index for source https://myorg.jfrog.io/myorg/api/nuget/v3/nuget-local.
The HTTP request to 'GET https://myorg.jfrog.io/myorg/api/nuget/v3/nuget-local' has timed out after 100000ms.
[stacktrace below]

Strangely dotnet restore doesn't timeout on the request, but instead returns a 500. Note that by default dotnet expects the nuget configuration to live at /root/.nuget/NuGet/NuGet.Config whereas nuget.exe expects /root/.config/NuGet/NuGet.Config. I just made a symlink from one to the other.

dotnet restore /v:d

[cropped]
Build FAILED.

   "/usr/app/AppName.App/AppName.App.csproj" (Restore target) (1) ->
   (Restore target) ->
     /usr/share/dotnet/sdk/2.1.302/NuGet.targets(114,5): error : Unable to load the service index for source https://myorg.jfrog.io/myorg/api/nuget/v3/nuget-local. [/usr/app/AppName.App/AppName.App.csproj]
   /usr/share/dotnet/sdk/2.1.302/NuGet.targets(114,5): error :   Response status code does not indicate success: 500 (Internal Server Error). [/usr/app/AppName.App/AppName.App.csproj]

0 Warning(s)
1 Error(s)

Verbose Logs

Stracktrace for mono /usr/local/bin/nuget.exe list -Source Artifactory -Verbosity detailed:

Unable to load the service index for source https://myorg.jfrog.io/myorg/api/nuget/nuget-local.
The HTTP request to 'GET https://myorg.jfrog.io/myorg/api/nuget/nuget-local' has timed out after 100000ms.
NuGet.Protocol.Core.Types.FatalProtocolException: Unable to load the service index for source https://myorg.jfrog.io/myorg/api/nuget/nuget-local. ---> System.TimeoutException: The HTTP request to 'GET https://myorg.jfrog.io/myorg/api/nuget/nuget-local' has timed out after 100000ms.
at NuGet.Protocol.TimeoutUtility+d__01[T].MoveNext () [0x00152] in <845485c546924737a40430d80ba302fd>:0 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <8f2c484307284b51944a1a13a14c0266>:0 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0004e] in <8f2c484307284b51944a1a13a14c0266>:0 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in <8f2c484307284b51944a1a13a14c0266>:0 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in <8f2c484307284b51944a1a13a14c0266>:0 at System.Runtime.CompilerServices.TaskAwaiter1[TResult].GetResult () [0x00000] in <8f2c484307284b51944a1a13a14c0266>:0
at NuGet.Protocol.HttpRetryHandler+d__0.MoveNext () [0x002f2] in <845485c546924737a40430d80ba302fd>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0004e] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Runtime.CompilerServices.TaskAwaiter1[TResult].GetResult () [0x00000] in <8f2c484307284b51944a1a13a14c0266>:0 at NuGet.Protocol.HttpSource+<GetThrottledResponse>d__20.MoveNext () [0x001c6] in <845485c546924737a40430d80ba302fd>:0 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <8f2c484307284b51944a1a13a14c0266>:0 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0004e] in <8f2c484307284b51944a1a13a14c0266>:0 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in <8f2c484307284b51944a1a13a14c0266>:0 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in <8f2c484307284b51944a1a13a14c0266>:0 at System.Runtime.CompilerServices.TaskAwaiter1[TResult].GetResult () [0x00000] in <8f2c484307284b51944a1a13a14c0266>:0
at NuGet.Protocol.HttpSource+d__181[T].MoveNext () [0x000cb] in <845485c546924737a40430d80ba302fd>:0 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <8f2c484307284b51944a1a13a14c0266>:0 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0004e] in <8f2c484307284b51944a1a13a14c0266>:0 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in <8f2c484307284b51944a1a13a14c0266>:0 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in <8f2c484307284b51944a1a13a14c0266>:0 at System.Runtime.CompilerServices.TaskAwaiter1[TResult].GetResult () [0x00000] in <8f2c484307284b51944a1a13a14c0266>:0
at ODataServiceDocumentUtils+d__0.MoveNext () [0x000d5] in <845485c546924737a40430d80ba302fd>:0
--- End of inner exception stack trace ---
at ODataServiceDocumentUtils+d__0.MoveNext () [0x00138] in <845485c546924737a40430d80ba302fd>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0004e] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Runtime.CompilerServices.TaskAwaiter1[TResult].GetResult () [0x00000] in <8f2c484307284b51944a1a13a14c0266>:0 at NuGet.Protocol.ODataServiceDocumentResourceV2Provider+<TryCreate>d__8.MoveNext () [0x0024b] in <845485c546924737a40430d80ba302fd>:0 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <8f2c484307284b51944a1a13a14c0266>:0 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0004e] in <8f2c484307284b51944a1a13a14c0266>:0 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in <8f2c484307284b51944a1a13a14c0266>:0 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in <8f2c484307284b51944a1a13a14c0266>:0 at System.Runtime.CompilerServices.TaskAwaiter1[TResult].GetResult () [0x00000] in <8f2c484307284b51944a1a13a14c0266>:0
at NuGet.Protocol.Core.Types.SourceRepository+d__161[T].MoveNext () [0x000b8] in <845485c546924737a40430d80ba302fd>:0 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <8f2c484307284b51944a1a13a14c0266>:0 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0004e] in <8f2c484307284b51944a1a13a14c0266>:0 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in <8f2c484307284b51944a1a13a14c0266>:0 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in <8f2c484307284b51944a1a13a14c0266>:0 at System.Runtime.CompilerServices.TaskAwaiter1[TResult].GetResult () [0x00000] in <8f2c484307284b51944a1a13a14c0266>:0
at NuGet.Protocol.V2FeedListResourceProvider+d__1.MoveNext () [0x00165] in <845485c546924737a40430d80ba302fd>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0004e] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Runtime.CompilerServices.TaskAwaiter1[TResult].GetResult () [0x00000] in <8f2c484307284b51944a1a13a14c0266>:0 at NuGet.Protocol.Core.Types.SourceRepository+<GetResourceAsync>d__161[T].MoveNext () [0x000b8] in <845485c546924737a40430d80ba302fd>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0004e] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <8f2c484307284b51944a1a13a14c0266>:0
at NuGet.Commands.ListCommandRunner+d__0.MoveNext () [0x000df] in <845485c546924737a40430d80ba302fd>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0004e] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <8f2c484307284b51944a1a13a14c0266>:0
at NuGet.CommandLine.ListCommand+d__20.MoveNext () [0x0010a] in <845485c546924737a40430d80ba302fd>:0

Stacktrace for v3 repository mono /usr/local/bin/nuget.exe list -Source ArtifactoryNuGetV3 -Verbosity detailed:

NuGet Version: 4.7.1.5393
Unable to load the service index for source https://myorg.jfrog.io/myorg/api/nuget/v3/nuget-local.
The HTTP request to 'GET https://myorg.jfrog.io/myorg/api/nuget/v3/nuget-local' has timed out after 100000ms.
NuGet.Protocol.Core.Types.FatalProtocolException: Unable to load the service index for source https://myorg.jfrog.io/myorg/api/nuget/v3/nuget-local. ---> System.TimeoutException: The HTTP request to 'GET https://myorg.jfrog.io/myorg/api/nuget/v3/nuget-local' has timed out after 100000ms.
at NuGet.Protocol.TimeoutUtility+d__01[T].MoveNext () [0x00152] in <845485c546924737a40430d80ba302fd>:0 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <8f2c484307284b51944a1a13a14c0266>:0 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0004e] in <8f2c484307284b51944a1a13a14c0266>:0 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in <8f2c484307284b51944a1a13a14c0266>:0 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in <8f2c484307284b51944a1a13a14c0266>:0 at System.Runtime.CompilerServices.TaskAwaiter1[TResult].GetResult () [0x00000] in <8f2c484307284b51944a1a13a14c0266>:0
at NuGet.Protocol.HttpRetryHandler+d__0.MoveNext () [0x002f2] in <845485c546924737a40430d80ba302fd>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0004e] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Runtime.CompilerServices.TaskAwaiter1[TResult].GetResult () [0x00000] in <8f2c484307284b51944a1a13a14c0266>:0 at NuGet.Protocol.HttpSource+<GetThrottledResponse>d__20.MoveNext () [0x001c6] in <845485c546924737a40430d80ba302fd>:0 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <8f2c484307284b51944a1a13a14c0266>:0 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0004e] in <8f2c484307284b51944a1a13a14c0266>:0 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in <8f2c484307284b51944a1a13a14c0266>:0 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in <8f2c484307284b51944a1a13a14c0266>:0 at System.Runtime.CompilerServices.TaskAwaiter1[TResult].GetResult () [0x00000] in <8f2c484307284b51944a1a13a14c0266>:0
at NuGet.Protocol.HttpSource+d__181[T].MoveNext () [0x000cb] in <845485c546924737a40430d80ba302fd>:0 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <8f2c484307284b51944a1a13a14c0266>:0 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0004e] in <8f2c484307284b51944a1a13a14c0266>:0 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in <8f2c484307284b51944a1a13a14c0266>:0 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in <8f2c484307284b51944a1a13a14c0266>:0 at System.Runtime.CompilerServices.TaskAwaiter1[TResult].GetResult () [0x00000] in <8f2c484307284b51944a1a13a14c0266>:0
at ODataServiceDocumentUtils+d__0.MoveNext () [0x000d5] in <845485c546924737a40430d80ba302fd>:0
--- End of inner exception stack trace ---
at ODataServiceDocumentUtils+d__0.MoveNext () [0x00138] in <845485c546924737a40430d80ba302fd>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0004e] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Runtime.CompilerServices.TaskAwaiter1[TResult].GetResult () [0x00000] in <8f2c484307284b51944a1a13a14c0266>:0 at NuGet.Protocol.ODataServiceDocumentResourceV2Provider+<TryCreate>d__8.MoveNext () [0x0024b] in <845485c546924737a40430d80ba302fd>:0 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <8f2c484307284b51944a1a13a14c0266>:0 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0004e] in <8f2c484307284b51944a1a13a14c0266>:0 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in <8f2c484307284b51944a1a13a14c0266>:0 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in <8f2c484307284b51944a1a13a14c0266>:0 at System.Runtime.CompilerServices.TaskAwaiter1[TResult].GetResult () [0x00000] in <8f2c484307284b51944a1a13a14c0266>:0
at NuGet.Protocol.Core.Types.SourceRepository+d__161[T].MoveNext () [0x000b8] in <845485c546924737a40430d80ba302fd>:0 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <8f2c484307284b51944a1a13a14c0266>:0 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0004e] in <8f2c484307284b51944a1a13a14c0266>:0 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in <8f2c484307284b51944a1a13a14c0266>:0 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in <8f2c484307284b51944a1a13a14c0266>:0 at System.Runtime.CompilerServices.TaskAwaiter1[TResult].GetResult () [0x00000] in <8f2c484307284b51944a1a13a14c0266>:0
at NuGet.Protocol.V2FeedListResourceProvider+d__1.MoveNext () [0x00165] in <845485c546924737a40430d80ba302fd>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0004e] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Runtime.CompilerServices.TaskAwaiter1[TResult].GetResult () [0x00000] in <8f2c484307284b51944a1a13a14c0266>:0 at NuGet.Protocol.Core.Types.SourceRepository+<GetResourceAsync>d__161[T].MoveNext () [0x000b8] in <845485c546924737a40430d80ba302fd>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0004e] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <8f2c484307284b51944a1a13a14c0266>:0
at NuGet.Commands.ListCommandRunner+d__0.MoveNext () [0x000df] in <845485c546924737a40430d80ba302fd>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0004e] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in <8f2c484307284b51944a1a13a14c0266>:0
at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <8f2c484307284b51944a1a13a14c0266>:0
at NuGet.CommandLine.ListCommand+d__20.MoveNext () [0x0010a] in <845485c546924737a40430d80ba302fd>:0

@zhili1208
Copy link
Contributor

this looks like the issue #4538, it should be fixed in NuGet 5.0 by NuGet/NuGet.Client#2382

@zhili1208
Copy link
Contributor

Could you try to restore with -DisableParallelProcessing?

@chrishiestand
Copy link
Author

@zhili1208 thanks for the reply. That doesn't seem to help:

dotnet restore --disable-parallel

Restoring packages for /usr/app/AppName.App/AppName.App.csproj...
/usr/share/dotnet/sdk/2.1.302/NuGet.targets(114,5): error : Unable to load the service index for source https://myorg.jfrog.io/myorg/api/nuget/v3/nuget-local. [/usr/app/AppName.App/AppName.App.csproj]
/usr/share/dotnet/sdk/2.1.302/NuGet.targets(114,5): error : Response status code does not indicate success: 500 (Internal Server Error). [/usr/app/AppName.App/AppName.App.csproj]

@zhili1208, I think it may be lack of TLS 1.2 support. Follow up comment shortly.

@chrishiestand
Copy link
Author

chrishiestand commented Aug 15, 2018

Could the problem be that nuget does not support TLS 1.2? Hosted Artifactory requires TLS 1.2 as seen at https://www.ssllabs.com/ssltest/analyze.html?d=myorg.jfrog.io&s=34.233.72.116&hideResults=on. Related is this old nuget issue: #3947

I found that using the mono TLS certificate manager would also hang:

certmgr -ssl -m https://myorg.jfrog.io

Mono Certificate Manager - version 4.6.2.0
Manage X.509 certificates and CRL from stores.
Copyright 2002, 2003 Motus Technologies. Copyright 2004-2008 Novell. BSD licensed.
[hang]

So I tried this TlsTest tool: https://github.com/duplicati/duplicati/tree/master/thirdparty/TlsTest
And this tool also hangs:

mono TlsTest.exe https://myorg.jfrog.io

or:

mono TlsTest.exe --tls1 https://myorg.jfrog.io

unless you pass the tls11 or tls12 flags:

mono TlsTest.exe --tls12 https://myorg.jfrog.io/myorg/api/nuget/nuget-local/

https://myorg.jfrog.io/myorg/api/nuget/nuget-local/
FAILED: #-2146232800
System.IO.IOException: The authentication or decryption has failed. ---> System.IO.IOException: Error while sending TLS Alert (Fatal:InternalError): System.NotSupportedException: Unsupported security protocol type
at Mono.Security.Protocol.Tls.Context.get_SecurityProtocol () [0x00045] in <1d0bb82c94e7435eb09324cf5ef20e36>:0
at Mono.Security.Protocol.Tls.SslClientStream.BeginNegotiateHandshake (System.AsyncCallback callback, System.Object state) [0x0001b] in <1d0bb82c94e7435eb09324cf5ef20e36>:0
at Mono.Security.Protocol.Tls.SslStreamBase.BeginNegotiateHandshake (Mono.Security.Protocol.Tls.SslStreamBase+InternalAsyncResult asyncResult) [0x00021] in <1d0bb82c94e7435eb09324cf5ef20e36>:0 ---> System.NotSupportedException: Unsupported security protocol type
at Mono.Security.Protocol.Tls.Context.get_SecurityProtocol () [0x00045] in <1d0bb82c94e7435eb09324cf5ef20e36>:0
at Mono.Security.Protocol.Tls.Context.get_Protocol () [0x00000] in <1d0bb82c94e7435eb09324cf5ef20e36>:0
at Mono.Security.Protocol.Tls.RecordProtocol.EncodeRecord (Mono.Security.Protocol.Tls.ContentType contentType, System.Byte[] recordData, System.Int32 offset, System.Int32 count) [0x00095] in <1d0bb82c94e7435eb09324cf5ef20e36>:0
at Mono.Security.Protocol.Tls.RecordProtocol.EncodeRecord (Mono.Security.Protocol.Tls.ContentType contentType, System.Byte[] recordData) [0x00000] in <1d0bb82c94e7435eb09324cf5ef20e36>:0
at Mono.Security.Protocol.Tls.RecordProtocol.BeginSendRecord (Mono.Security.Protocol.Tls.ContentType contentType, System.Byte[] recordData, System.AsyncCallback callback, System.Object state) [0x0001d] in <1d0bb82c94e7435eb09324cf5ef20e36>:0
at Mono.Security.Protocol.Tls.RecordProtocol.SendRecord (Mono.Security.Protocol.Tls.ContentType contentType, System.Byte[] recordData) [0x00000] in <1d0bb82c94e7435eb09324cf5ef20e36>:0
at Mono.Security.Protocol.Tls.RecordProtocol.SendAlert (Mono.Security.Protocol.Tls.Alert alert) [0x00027] in <1d0bb82c94e7435eb09324cf5ef20e36>:0
at Mono.Security.Protocol.Tls.RecordProtocol.SendAlert (System.Exception& ex) [0x00021] in <1d0bb82c94e7435eb09324cf5ef20e36>:0
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
at Mono.Security.Protocol.Tls.SslStreamBase.BeginNegotiateHandshake (Mono.Security.Protocol.Tls.SslStreamBase+InternalAsyncResult asyncResult) [0x00072] in <1d0bb82c94e7435eb09324cf5ef20e36>:0
at Mono.Security.Protocol.Tls.SslStreamBase.NegotiateHandshake () [0x00018] in <1d0bb82c94e7435eb09324cf5ef20e36>:0
at Mono.Security.Protocol.Tls.SslStreamBase.Write (System.Byte[] buffer, System.Int32 offset, System.Int32 count) [0x00076] in <1d0bb82c94e7435eb09324cf5ef20e36>:0
at System.IO.StreamWriter.Flush (System.Boolean flushStream, System.Boolean flushEncoder) [0x00094] in <8f2c484307284b51944a1a13a14c0266>:0
at System.IO.StreamWriter.Flush () [0x00006] in <8f2c484307284b51944a1a13a14c0266>:0
at TlsTest.GetStreamPage (System.String url) [0x000e1] in :0
at TlsTest.Main (System.String[] args) [0x0030a] in :0

So I don't know what that TlsTest error message is about, but at least it doesn't hang.

@chrishiestand
Copy link
Author

chrishiestand commented Aug 15, 2018

Side note: the tlstest tool that ships with mono doesn't currently support TLS 1.2: https://raw.githubusercontent.com/mono/mono/master/mcs/class/Mono.Security/Test/tools/tlstest/tlstest.cs

@zhili1208
Copy link
Contributor

thanks for your information, then it looks like a mono issue. @mrward any ideas?

@mrward
Copy link
Member

mrward commented Aug 16, 2018

Not sure this is a Mono problem. It looks as though the same Unable to load the service index for source error occurs with dotnet restore which will not be using Mono.

@chrishiestand
Copy link
Author

@mrward The dotnet restore command returns with 500 immediately, whereas the nuget and mono commands hang until they timeout in 100s. They could be separate issues.

@nkolev92
Copy link
Member

Could this be related to the max http requests work you did Zhi?
#4538

@chrishiestand Can you please try using --disable-parallel with dotnet?

@chrishiestand
Copy link
Author

@nkolev92 Thanks for taking a look, unfortunately that's what @zhili1208 thought too but it doesn't seem to help: #7206 (comment) .

@nkolev92
Copy link
Member

oh I missed that part.
I scrolled too far down past the stack trace :)

@jainaashish
Copy link
Contributor

So here are two parts of this issue:

  1. nuget.exe with mono - Mono doesn't support tls12 and request timeouts after 100s. Dupe of [Mono issue] can't connect to server with tls 1.0, tls 1.1, tls 1.2 #3947

  2. dotnet.exe - request failed with 500 Internal server error. @chrishiestand can you tell us couple of things:
    a. Is this specific to artifactory source or can you repro it with any other feed as well?
    b. Can you connect to that artifactory server from that docker image?

@chrishiestand
Copy link
Author

chrishiestand commented Aug 31, 2018

@jainaashish That is a good breakdown. At the time of issue creation I wasn't sure to what degree mono and dotnet were separate.

I finally figured out the problem when I learned that you can view the request logs from the artifactory side. Artifactory was showing 401 errors, even though the dotnet restore client was showing 500 errors. Learning it was an auth issue led me to to figure out how to properly configure the NuGet.Config for dotnet linux clients against Artifactory. So there's still a bug somewhere because dotnet should report a 401 error instead of a 500 if indeed that is what the nuget server is responding with.

For anyone else with this problem with Artifactory here is how your NuGet.Config file should look (since the linux dotnet client does not yet support encrypted passwords)

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
    <add key="Artifactory" value="https://myorg.jfrog.io/myorg/api/nuget/nuget-local" />
  </packageSources>
  <packageSourceCredentials>
    <Artifactory>
      <add key="Username" value="username" />
      <add key="ClearTextPassword" value="password" />
    </Artifactory>
  </packageSourceCredentials>
</configuration>

And also be aware that by default dotnet expects the nuget configuration to live at $HOME/.nuget/NuGet/NuGet.Config whereas (via mono) nuget.exe expects $HOME/.config/NuGet/NuGet.Config. So if you use mono nuget.exe to write to the config file you'll want to also make that file accessible to dotnet restore by moving/symlinking/copying to $HOME/.nuget/NuGet/NuGet.Config or the local project directory.

Lastly, with dotnet restore working I went back and tried mono /usr/local/bin/nuget.exe list -Source Artifactory -ConfigFile $HOME/.nuget/NuGet/NuGet.Config -Verbosity detailed and it still hangs. That does seem to be the TLS issue still.

@chrishiestand
Copy link
Author

So in summary the 2 bugs are:

  1. nuget.exe with mono - Mono doesn't support tls12 and request timeouts after 100s. Dupe of [Mono issue] can't connect to server with tls 1.0, tls 1.1, tls 1.2 #3947
  2. dotnet restore does not pass through server error of 401 and instead shows 500

I'm fine with closing this issue now, or whatever you all would like to do.

@PatoBeltran
Copy link

Will close the issue since @chrishiestand mentioned the underlying mono bug has already a tracking issue.

@PatoBeltran PatoBeltran added Resolution:External This issue appears to be External to nuget and removed Triage:Investigate labels Jan 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Platform:Xplat Resolution:External This issue appears to be External to nuget
Projects
None yet
Development

No branches or pull requests

6 participants