rolfwessels / docker-simple-nuget-server

Docker file and auto building of simple-nuget-server
MIT License
11 stars 8 forks source link

502 Bad Gateway while running `dotnet restore` or `dotnet build` #4

Open msschl opened 5 years ago

msschl commented 5 years ago

While running a dotnet restore or dotnet build some request to the private nuget server returns a 502 Bad Gateway. Here are the logs:

...
10.244.2.73 - - [13/Oct/2019:18:14:29 +0000] "GET /FindPackagesById()?id='System.Collections.Immutable'&semVerLevel=2.0.0 HTTP/1.1" 502 173 "-" "NuGet .NET Core MSBuild Task/5.3.0 (Linux 4.15.0-65-generic #74-Ubuntu SMP Tue Sep 17 17:06:04 UTC 2019)" "10.244.2.1"
2019/10/13 18:14:29 [error] 49#49: *1885 connect() to unix:/var/run/php/php7.0-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 10.244.2.73, server: nuget.kube-dev.local, request: "GET /FindPackagesById()?id='System.Security.Principal.Windows'&semVerLevel=2.0.0 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "nuget.kube-dev.local"
2019/10/13 18:14:29 [error] 49#49: *2125 connect() to unix:/var/run/php/php7.0-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 10.244.2.73, server: nuget.kube-dev.local, request: "GET /FindPackagesById()?id='System.Security.Permissions'&semVerLevel=2.0.0 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "nuget.kube-dev.local"
2019/10/13 18:14:29 [error] 49#49: *2136 connect() to unix:/var/run/php/php7.0-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 10.244.2.73, server: nuget.kube-dev.local, request: "GET /FindPackagesById()?id='runtime.native.System.IO.Compression'&semVerLevel=2.0.0 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "nuget.kube-dev.local"
2019/10/13 18:14:29 [error] 49#49: *2137 connect() to unix:/var/run/php/php7.0-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 10.244.2.73, server: nuget.kube-dev.local, request: "GET /FindPackagesById()?id='xunit.extensibility.core'&semVerLevel=2.0.0 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "nuget.kube-dev.local"
2019/10/13 18:14:29 [error] 49#49: *2139 connect() to unix:/var/run/php/php7.0-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 10.244.2.73, server: nuget.kube-dev.local, request: "GET /FindPackagesById()?id='Microsoft.VisualStudio.Web.CodeGeneration'&semVerLevel=2.0.0 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "nuget.kube-dev.local"
2019/10/13 18:14:29 [error] 49#49: *2141 connect() to unix:/var/run/php/php7.0-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 10.244.2.73, server: nuget.kube-dev.local, request: "GET /FindPackagesById()?id='System.Collections.Immutable'&semVerLevel=2.0.0 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "nuget.kube-dev.local"
10.244.2.73 - - [13/Oct/2019:18:14:29 +0000] "GET /FindPackagesById()?id='Microsoft.Extensions.ApiDescription.Server'&semVerLevel=2.0.0 HTTP/1.1" 200 490 "-" "NuGet .NET Core MSBuild Task/5.3.0 (Linux 4.15.0-65-generic #74-Ubuntu SMP Tue Sep 17 17:06:04 UTC 2019)" "10.244.2.1"
10.244.2.73 - - [13/Oct/2019:18:14:29 +0000] "GET /FindPackagesById()?id='Microsoft.Extensions.Diagnostics.HealthChecks'&semVerLevel=2.0.0 HTTP/1.1" 200 490 "-" "NuGet .NET Core MSBuild Task/5.3.0 (Linux 4.15.0-65-generic #74-Ubuntu SMP Tue Sep 17 17:06:04 UTC 2019)" "10.244.2.1"
10.244.2.73 - - [13/Oct/2019:18:14:29 +0000] "GET /FindPackagesById()?id='System.Security.Permissions'&semVerLevel=2.0.0 HTTP/1.1" 502 173 "-" "NuGet .NET Core MSBuild Task/5.3.0 (Linux 4.15.0-65-generic #74-Ubuntu SMP Tue Sep 17 17:06:04 UTC 2019)" "10.244.2.1"
...

I think that while a restore is running, there are to many request per seconds.

rolfwessels commented 5 years ago

I think you might want to check out the original author. https://github.com/Daniel15/simple-nuget-server.

This repo is just a wrapper to allow it to be run using docker.

msschl commented 5 years ago

But the nginx and php configuration files are created here and not in the original repo.

I think this issue is due to a configuration issue.

rolfwessels commented 5 years ago

Hmm, I see https://github.com/rolfwessels/docker-simple-nuget-server/pull/3 said that there was an issue with absolute paths. Not sure if its related. Let me put it up on dockerhub and lets see.

rolfwessels commented 5 years ago

I really cant see enough info from your log to say why a 502 would happen.

rolfwessels commented 5 years ago

I found this https://stackoverflow.com/questions/39818999/php-fpm-and-nginx-resource-temporarily-unavailable-errors-in-proxy-error-log which seems related to your issue. But that stack overflow answer does not give me hope.

How many requests are you doing per second? Do simple commands to restore work? eg.

nuget.exe setApiKey -Source http://192.168.1.250:8083/  e46c582041db4cbe86a84b76a374383a
nuget.exe list -Source http://192.168.1.250:8083/ 
nuget.exe push Antlr.3.4.1.9004.nupkg -Source http://192.168.1.250:8083/ -ApiKey e46c582041db4cbe86a84b76a374383a
nuget.exe list -Source http://192.168.1.250:8083/
nuget.exe install -Source http://192.168.1.250:8083/ Antlr 
rolfwessels commented 5 years ago

Looking at https://github.com/NuGet/Home/issues/4538 there is a settings in nuget.config maxHttpRequest that might help to rate limit the requests that are sent to your server.

msschl commented 5 years ago

I've testet setting maxHttpRequest in the nuget.config but it doesn't help. Running the dotnet restore with --disable-parallel fixes the issue.

I found this online https://talk.plesk.com/threads/php-fpm-sock-failed-1000-users-online.341428/ Maybe this helps

rolfwessels commented 5 years ago

Thanks, I will have a look

rolfwessels commented 5 years ago

I've update the max children count to 400. Could you please test and let me know if its working for you Tag:v1.1.23-develop

msschl commented 5 years ago

Still the same error