Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.

If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!

Nuget push fails when Proget is running on linux and nuget client is >= 3.5



  • The command:

    .\nuget.3.5.exe push  .\test.1.0.0.nupkg -Source http://myserver/nuget/nuget-all -apikey progetkey -verbosity detailed
    

    Fails with error:

    NuGet Version: 3.5.0.1938
    Pushing test.1.0.0.nupkg to 'http://myserver/nuget/nuget-all'...
     PUT http://myserver/nuget/nuget-all/
     BadRequest http://myserver/nuget/nuget-all/ 52ms
    System.AggregateException: One or more errors occurred. ---> System.Net.Http.HttpRequestException: Response status code does not indicate success: 400 (Bad Request).
      at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
      at NuGet.Protocol.Core.Types.PackageUpdateResource.<>c.<PushPackageToServer>b__19_1(HttpResponseMessage response)
      at NuGet.Protocol.HttpSource.<ProcessResponseAsync>d__14`1.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at NuGet.Protocol.Core.Types.PackageUpdateResource.<PushPackageToServer>d__19.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at NuGet.Protocol.Core.Types.PackageUpdateResource.<PushPackageCore>d__13.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at NuGet.Protocol.Core.Types.PackageUpdateResource.<PushPackage>d__12.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at NuGet.Protocol.Core.Types.PackageUpdateResource.<Push>d__8.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at NuGet.Commands.PushRunner.<Run>d__0.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at NuGet.CommandLine.PushCommand.<ExecuteCommandAsync>d__28.MoveNext()
      --- End of inner exception stack trace ---
      at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
      at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
      at NuGet.CommandLine.Command.Execute()
      at NuGet.CommandLine.Program.MainCore(String workingDirectory, String[] args)
    ---> (Inner Exception #0) System.Net.Http.HttpRequestException: Response status code does not indicate success: 400 (Bad Request).
      at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
      at NuGet.Protocol.Core.Types.PackageUpdateResource.<>c.<PushPackageToServer>b__19_1(HttpResponseMessage response)
      at NuGet.Protocol.HttpSource.<ProcessResponseAsync>d__14`1.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at NuGet.Protocol.Core.Types.PackageUpdateResource.<PushPackageToServer>d__19.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at NuGet.Protocol.Core.Types.PackageUpdateResource.<PushPackageCore>d__13.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at NuGet.Protocol.Core.Types.PackageUpdateResource.<PushPackage>d__12.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at NuGet.Protocol.Core.Types.PackageUpdateResource.<Push>d__8.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at NuGet.Commands.PushRunner.<Run>d__0.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at NuGet.CommandLine.PushCommand.<ExecuteCommandAsync>d__28.MoveNext()<---
    

    Whereas the command:

     .\nuget.3.4.exe push .\test.1.0.0.nupkg -Source http://myserver/nuget/nuget-all -apikey progetkey -verbosity detailed
    

    Succeeds with message:

    Pushing test.1.0.0.nupkg to 'http://myserver/nuget/nuget-all'...
      PUT http://myserver/nuget/nuget-all/
      Created http://myserver/nuget/nuget-all/ 89ms
    Your package was pushed.
    

    By using fiddler, the response from the server is:

    X-UA-Compatible: IE=edge
    X-ProGet-Version: 4.7.11.7
    X-AspNet-Version: 4.0.30319
    Cache-Control: private
    Content-Type: text/html
    Server: Mono-HTTPAPI/1.0
    Date: Thu, 25 May 2017 17:33:48 GMT
    Content-Length: 34
    Connection: close
    
    There must be exactly one package.
    

    There are no issues when proget is run on windows.

    Product: ProGet
    Version: 4.7.11



  • We've investigated this a bit further, and have determined that it's a bug in .NET on Linux (Mono), specifically in the way chunked input streams are handled.

    It's not remotely trivial to debug, and it usually takes a long time to get a fix/pull/etc accepted. So, the workaround is to use an older NuGet client or just do regular HTTP Push.

    I've logged PG-1042 in the mean time to investigate. We will be considering a move to DNC at some point.



  • This is successfully worked around by putting an nginx wrapper in front of proget



  • Hey

    Thanks for the pointer to the nginx fix, works a treat.

    Here is my docker-compose setup for anyone looking for a quick and great fix...

    version: '3'
    services:
      proget-web:
        image: inedo/proget:latest
        ports:
          - "888:80"
        hostname: proget-web
        restart: always
        volumes:
          - "/var/proget/extensions:/var.progetextensions"
          - "/var/proget/packages:/var/proget/packages"
        depends_on:
          - proget-postgres
        expose:
          - "888"
      proget-postgres:
        image: postgres:9.5
        restart: always
        volumes:
          - "/etc/localtime:/etc/localtime:ro"
          - "/var/proget/db:/var/lib/postgresql/data"
      proxy:
        image: nginx:1.11
        ports:
          - "2345:2345"
        volumes:
          - ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
        depends_on:
          - proget-web


Inedo Website HomeSupport HomeCode of ConductForums GuideDocumentation