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

binarycaching: Allow setting NuGet network operations timeout #18483

Closed
ekilmer opened this issue Jun 16, 2021 · 4 comments · Fixed by #19084
Closed

binarycaching: Allow setting NuGet network operations timeout #18483

ekilmer opened this issue Jun 16, 2021 · 4 comments · Fixed by #19084
Assignees
Labels
category:documentation To resolve the issue, documentation will need to be updated category:vcpkg-feature The issue is a new capability of the tool that doesn’t already exist and we haven’t committed

Comments

@ekilmer
Copy link
Contributor

ekilmer commented Jun 16, 2021


Is your feature request related to a problem? Please describe.
While using the NuGet binarycaching feature for large packages like LLVM, I am running into network timeout issues while trying to push the package due to slow internet upload connection.

The default timeout for NuGet is 100 seconds, as documented here by usage of HttpClient: https://github.com/NuGet/NuGet.Client/blob/84d2f4e24f1f3e055dcc6056ae158d2e35123bd9/test/NuGet.Clients.FuncTests/NuGet.CommandLine.FuncTest/Commands/PushCommandTest.cs#L35-L36

Proposed solution
NuGet has the option to specify a -Timeout option to specify the number of seconds to allow before timing out. Ideally this could be configurable through a command-line option or environment variable (I'm not sure which is better, probably environment variable?) for vcpkg.

Describe alternatives you've considered
I'm not sure if there is a way to configure the timeout for NuGet without touching the command-line arguments. After searching around, I haven't found an option that would appear in the NuGet config file, and I'm not familiar with any other configuration files that would let me do this.

I've been able to create a hard-coded patch in the meantime, but this probably isn't ideal for everyone:

 diff --git a/src/vcpkg/binarycaching.cpp b/src/vcpkg/binarycaching.cpp
 index 356c7231..0723e4f2 100644
 --- a/src/vcpkg/binarycaching.cpp
 +++ b/src/vcpkg/binarycaching.cpp
 @@ -825,6 +825,9 @@ namespace
                          .string_arg("push")
                          .path_arg(nupkg_path)
                          .string_arg("-ForceEnglishOutput")
 +                        .string_arg("-Timeout")
 +                        // One hour and one second
 +                        .string_arg("3601")
                          .string_arg("-Source")
                          .string_arg(write_src);

 @@ -854,6 +857,9 @@ namespace
                          .string_arg("push")
                          .path_arg(nupkg_path)
                          .string_arg("-ForceEnglishOutput")
 +                        .string_arg("-Timeout")
 +                        // One hour and one second
 +                        .string_arg("3601")
                          .string_arg("-ConfigFile")
                          .path_arg(write_cfg);
                      if (!m_interactive)

Additional context
I've added the extra second (1 hour and 1 second) just to make sure I don't hit the potential issue with how NuGet calculates the timeout:
https://jfrog.com/knowledge-base/how-to-resolve-nuget-push-failures-after-5-minutes-even-though-timeout-value-is-set-as-greater-than-5-minutes-300-seconds/

Thank you!!

@JackBoosY
Copy link
Contributor

Can you please open a new PR to vcpkg-tool?

Thanks.

@JackBoosY JackBoosY added the category:vcpkg-feature The issue is a new capability of the tool that doesn’t already exist and we haven’t committed label Jun 17, 2021
@ekilmer
Copy link
Contributor Author

ekilmer commented Jul 13, 2021

This issue requires a bump to the vcpkg tool and a documentation update for nugettimeout to be closed.

@JackBoosY
Copy link
Contributor

This issue requires a bump to the vcpkg tool and a documentation update for nugettimeout to be closed.

Yes, waiting for the next release publish.

@NancyLi1013
Copy link
Contributor

The changes in PR microsoft/vcpkg-tool#95 have been merged to vcpkg master branch now. Currently, vcpkg.exe has been upgraded to 2021-07-21 in vcpkg. Please see

& "$scriptsDir/tls12-download.exe" github.com "/microsoft/vcpkg-tool/releases/download/2021-07-21/vcpkg.exe" "$vcpkgRootDir\vcpkg.exe"

Seems there is only a documentation for nugettimeout that needs to be done.

@NancyLi1013 NancyLi1013 added the category:documentation To resolve the issue, documentation will need to be updated label Jul 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:documentation To resolve the issue, documentation will need to be updated category:vcpkg-feature The issue is a new capability of the tool that doesn’t already exist and we haven’t committed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants