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

dotnet restore after 100000ms return for all request error message 'has timed out after 100000ms' #2657

Closed
joelverhagen opened this issue Apr 25, 2016 · 20 comments
Assignees
Milestone

Comments

@joelverhagen
Copy link
Member

@Gormy, we have moved this bug from https://github.com/dotnet/cli/issues/2674 since this seems to be a NuGet issue.

Steps to reproduce

Windows Server 2012 x64
I have solution with 4 projects. When I try run 'dotnet restore' from TeamCity runner, don`t load all packages,

Expected behavior

Load all packages from nuget

Actual behavior

Load packages only in first 100 seconds.

Environment data

dotnet restore output:
before 10000ms:
...
[repo-initialize] info : OK https://api.nuget.org/v3-flatcontainer/microsoft.aspnet.fileproviders.embedded/1.0.0-rc1-final/microsoft.aspnet.fileproviders.embedded.1.0.0-rc1-final.nupkg 93953ms
[repo-initialize] info : OK https://api.nuget.org/v3-flatcontainer/system.console/index.json 95377ms
[repo-initialize] info : GET https://api.nuget.org/v3-flatcontainer/microsoft.aspnet.fileproviders.abstractions/index.json
[repo-initialize] info : GET https://api.nuget.org/v3-flatcontainer/system.reflection/4.0.10/system.reflection.4.0.10.nupkg
[repo-initialize] info : GET https://api.nuget.org/v3-flatcontainer/system.console/4.0.0-beta-23516/system.console.4.0.0-beta-23516.nupkg
[repo-initialize] info : OK https://api.nuget.org/v3-flatcontainer/entityframework.relational.design/index.json 97882ms
[repo-initialize] info : GET https://api.nuget.org/v3-flatcontainer/entityframework.relational.design/7.0.0-rc1-final/entityframework.relational.design.7.0.0-rc1-final.nupkg
...

after 100000ms

...
[repo-initialize] info : An error was encountered when fetching 'GET https://api.nuget.org/v3-flatcontainer/system.linq.queryable/index.json';. The request will now be retried.
[repo-initialize] info : The HTTP request to 'GET https://api.nuget.org/v3-flatcontainer/system.linq.queryable/index.json'; has timed out after 100000ms.
...

@joelverhagen
Copy link
Member Author

joelverhagen commented Apr 25, 2016

Hey @Gormy, a couple questions to help understand the environment:

  • What version of .NET CLI are you using?
  • Do you happen to be running in Virtual Box? (looks similar to https://github.com/dotnet/cli/issues/1732)
  • Could you attach the full log as a file to this bug?
  • Does --disable-parallel help?
  • Does this problem reproduce on any restore? For example, does dotnet new in a new directory then dotnet restore cause the problem?
  • Could you attach the project.json and list of sources you are restoring from?
  • Does this problem reproduce on another machine? Another network? Another operating system?

@Gormy
Copy link

Gormy commented Apr 26, 2016

What version of .NET CLI are you using?

1.0.0-rc2-002485

Do you happen to be running in Virtual Box? (looks similar to dotnet/cli#1732)

No

Could you attach the full log as a file to this bug?

DEV_auto_deployment_45.txt

Does --disable-parallel help?

No

Does this problem reproduce on any restore? For example, does dotnet new in a new directory then dotnet restore cause the problem?

Yes

Could you attach the project.json and list of sources you are restoring from?

solution.txt

(change .txt to .zip)

Does this problem reproduce on another machine? Another network? Another operating system?

Didn`t check. On local machine i use Visual Studio

@joelverhagen
Copy link
Member Author

I have tried this restore on a Windows Server 2012 (not R2) machine and had did not see any problem. Does performing a similar restore using NuGet.exe (download from dist.nuget.org/index.html)? Could you try the v3.4.3 and v3.3.0 NuGet.exe?

Also, when you reproduce the problem, could you use Fiddler to capture the network failures? Since I am not able to reproduce it locally, it's hard for me to get a grasp of what is going on.

@Gormy
Copy link

Gormy commented Apr 28, 2016

I download latest nuget.exe and now if I use 'dotnet restore' from cmd, all packages restored. But in TeamCity I still the same errors. Fiddler don`t see requests from teamcity.

@joelverhagen
Copy link
Member Author

So, to clarify:

  • nuget.exe restore from CMD on your TeamCity agent works. Which nuget.exe version are you trying?
  • dotnet restore from CMD on your TeamCity agent works.
  • dotnet restore when running as part of the TeamCity build fails.

Does that accurately represent the problem?

@Gormy
Copy link

Gormy commented Apr 28, 2016

dotnet restore command result from cmd different from teamcity.

TeamCity result: all request from nuget has timeout:

1._DEV_auto_deployment_62.txt

CMD result: didn`t send request to nuget, only write that:

PS C:\TeamCity\buildAgent\work\e602d2b9cd736a2c\test> dotnet restore
log : Restoring packages for C:\TeamCity\buildAgent\work\e602d2b9cd736a2c\test\project.json...
info : GET https://api.nuget.org/v3-flatcontainer/microsoft.netcore.app/index.json
info : NotFound https://api.nuget.org/v3-flatcontainer/microsoft.netcore.app/index.json 595ms
info : GET https://myget-2e16.kxcdn.com/artifacts/aspnetvnext/nuget/v3/flatcontainer/microsoft.netcore.app/index.json
info : GET https://myget-2e16.kxcdn.com/artifacts/aspnet-contrib/nuget/v3/flatcontainer/microsoft.netcore.app/index.j
on
info : OK https://myget-2e16.kxcdn.com/artifacts/aspnetvnext/nuget/v3/flatcontainer/microsoft.netcore.app/index.json
25ms
info : NotFound https://myget-2e16.kxcdn.com/artifacts/aspnet-contrib/nuget/v3/flatcontainer/microsoft.netcore.app/in
ex.json 582ms
error: Unable to resolve 'Microsoft.NETCore.App (>= 1.0.0-rc2-3002543)' for '.NETCoreApp,Version=v1.0'.
info : Committing restore...
log : Writing lock file to disk. Path: C:\TeamCity\buildAgent\work\e602d2b9cd736a2c\test\project.lock.json
log : C:\TeamCity\buildAgent\work\e602d2b9cd736a2c\test\project.json
log : Restore failed in 104013ms.

Errors in C:\TeamCity\buildAgent\work\e602d2b9cd736a2c\test\project.json
Unable to resolve 'Microsoft.NETCore.App (>= 1.0.0-rc2-3002543)' for '.NETCoreApp,Version=v1.0'.

NuGet Config files used:
C:\Users\Administrator\AppData\Roaming\NuGet\NuGet.Config

Feeds used:
https://api.nuget.org/v3/index.json
http://www.myget.org/F/aspnetvnext/api/v3/index.json

https://www.myget.org/F/aspnet-contrib/api/v3/index.json

@Gormy
Copy link

Gormy commented Apr 28, 2016

Now, when I try to use dotnet restore for my project from CMD, I the same result as in TeamCIty. How can I check which version nuget is use dotnet?

@joelverhagen
Copy link
Member Author

.NET CLI version 1.0.0-rc2-002485 shipped with NuGet build 3.5.0-beta-1199.

The NuGet version that ships with dotnet does not necessarily have a corresponding nuget.exe release. But you can find the NuGet build number by:

  1. Go to the same directory as the dotnet executable.
  2. Go to sdk\<CLI version>.
  3. Find a NuGet DLL (such as NuGet.Versioning.dll).
  4. Right-click on it, click on Properties, then the Details tab.
  5. Look at the Product version field.

image

@Gormy
Copy link

Gormy commented Apr 28, 2016

I understand that problem is in shipped NuGeT. Is it?

@joelverhagen
Copy link
Member Author

We are not able to reproduce this issue on our end. Could you send an email to support@nuget.org with some Skype contact details? We can work together directly. I won't be able to diagnose this problem unless I have access to the machine.

@Gormy
Copy link

Gormy commented May 3, 2016

I send a email to support@nuget.org,

@joelverhagen
Copy link
Member Author

@Gormy, any luck debugging those network or proxy issues you were facing? To reiterate, I would try to figure out why this Powershell command is hanging

Invoke-WebRequest https://api.nuget.org/v3/index.json

@joelverhagen
Copy link
Member Author

I spoke to the OP offline and his issue has been resolved. The issue seemed to be related with some proxy settings and that TeamCity was not running as an administrator and was not related to a failure in NuGet itself.

@fcallejon
Copy link

fcallejon commented Aug 5, 2016

Hi I'm having the same issue.
Invoke-WebRequest hangs (despite I set TimeoutSec), but after ~5 mins it returns.

PS > Invoke-WebRequest https://api.nuget.org/v3-flatcontainer/microsoft.aspnetcore.mvc.razor/inde
x.json -TimeoutSec 10

StatusCode : 200
StatusDescription : OK
Content : {
"versions": [
"0.0.1-alpha",
"1.0.0-rc2-final",
"1.0.0"
]
}
RawContent : HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: x-ms-request-id,Server,x-ms-version,x-ms-write-protection,Content-Ty
pe,Cache-Control,Last-Modified,ETag,Content-MD5,x-ms...
Forms : {}
Headers : {[Access-Control-Allow-Origin, *], [Access-Control-Expose-Headers, x-ms-request-id,Server,x-ms-vers
ion,x-ms-write-protection,Content-Type,Cache-Control,Last-Modified,ETag,Content-MD5,x-ms-lease-stat
us,x-ms-blob-type,Content-Length,Date,Transfer-Encoding], [Content-MD5, m64ebl0Fdr/CqU3ca0GRsA==],
[X-CDN-Rewrite, Lowercase blobs in v3-flatcontainer]...}
Images : {}
InputFields : {}
Links : {}
ParsedHtml : mshtml.HTMLDocumentClass
RawContentLength : 83

If i run "nuget restore", either including disable parallel or not, I can get the nugets. But dotnet restore doesn't work.

dotnet --version: 1.0.0-preview3-003223
dotnet --info:

.NET Command Line Tools (1.0.0-preview3-003223)

Product Information:
Version: 1.0.0-preview3-003223
Commit SHA-1 hash: 9d3b727392

Runtime Environment:
OS Name: Windows
OS Version: 6.1.7601
OS Platform: Windows
RID: win7-x64

Here is the log

@daniel-bytes
Copy link

I was just experiencing this issue today. It turns out the issue was that I was connected to a corporate VPN. If you are having timeout issues restoring packages, definitely make sure there are no VPN connections open, and if so try closing them out and see if that helps.

@WhiteKarma
Copy link

Hello all,
I could only solve the problem upgrading to powershell version 3 on the link below:
https://www.microsoft.com/en-us/download/details.aspx?id=34595

All the best

@mcliment
Copy link

mcliment commented Feb 2, 2017

I'll add a comment that may help some users that are having troubles with this because my CI server agent is running on a System account.

To diagnose and possibly solve the problem you'll need psexec.exe that can be downloaded here: https://live.sysinternals.com

Then, you can execute Powershell as the System account (from an Administrator command line):

psexec -i -s powershell

Once on the new Powershell console, try this:

Invoke-WebRequest https://api.nuget.org/v3-flatcontainer/microsoft.aspnetcore.mvc.razor/index.json -TimeoutSec 10

If you get a weird error about the Internet Explorer engine not being available, continue...
I don't know exactly what the problem is but you have to launch Internet Explorer under the System account:

psexec -s -i "%programfiles%\Internet Explorer\iexplore.exe"

Then just close it (I went to internet options, but I don't think is necessary).

Try again the Invoke-WebRequest command and it should work.

From now on my problems with dotnet restore through the CI server disappeared. I hope this helps someone!

@thrashard
Copy link

Thanks @mcliment - I was experiencing the same issue on our CI server, and your solution worked perfectly.

@jasselin
Copy link

The fix proposed by @mcliment works, just be sure to use psexec with "-u accountname" if you service runs under different account. :)

@blackn1ght
Copy link

blackn1ght commented Apr 24, 2017

Unfortunately, @mcliment's answer doesn't fix it for us. We can dotnet new and dotnet restore successfully, but the TeamCity restore still times out.

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

No branches or pull requests

10 participants