-
Notifications
You must be signed in to change notification settings - Fork 252
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 nuget push fails when pushing a relatively large package (3.4MB) to Github #12926
Comments
Hello, |
@donnie-msft Hi, I just checked. I only have Windows Firewall and both Do you need any log file I can provide? I can reproduce it consistently, one successful upload for a smaller file and one fail upload for the bigger file. |
If you can try running a Fiddler trace when performing the My guess at the difference you're seeing is due to the difference in HTTP handling between |
Hi, I have tried pushing with Fiddler on, unfortunately it fails with dotnet nuget:
nuget:
Fiddler error:
Do you think the |
I believe Fiddler has some guidance on working with HTTPS connections, so not sure if that's part of the errors you're seeing with it. It's interesting that the IOException is the same "aborted" message you saw from A few questions coming to mind:
|
Hi, after some testing, here are some more info:
{
"tls_sni_status": "present",
"scheme": "https",
"tls_version": "tls1.3",
"tls_sni_value": "check-tls.akamai.io",
"host_header_value": "check-tls.akamai.io",
"tls_cipher_name": "TLS_AES_256_GCM_SHA384",
"alpn": "",
"client_ip": "[removed]",
"client_ip_version": "ipv4",
"client_port": [removed],
"user_agent": "None",
"output_version": "0.1.21",
"timestamp": 1697556916
} I also manually set the TLS version to 1.2. Both 1.2 and 1.3 has the same issue:
Interestingly, this time instead of curl I used another HTTP client Insomnia, and it successfully pushes the package as well. No header needed except the
I also suspected it's due to the File Stream, so I loaded it into a using System.Net;
using System.Text;
const string Package = @"D:\Temp\Test.Assets.1.0.0.nupkg";
const string Source = "https://nuget.pkg.github.com/[organization]/";
//var url = $"{Source}api/v2/package";
var url = $"{Source}";
const string User = "[email]";
var key = Environment.GetEnvironmentVariable("GithubKey");
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
using var handler = new HttpClientHandler();
handler.SslProtocols = System.Security.Authentication.SslProtocols.Tls12;
using var http = new HttpClient(handler);
//using var http = new HttpClient();
Console.WriteLine(await http.GetStringAsync("https://check-tls.akamai.io/v1/tlsinfo.json"));
using var req = new HttpRequestMessage(HttpMethod.Put, url);
var auth = Convert.ToBase64String(Encoding.ASCII.GetBytes($"{User}:{key}"));
//req.Headers.Add("Authorization", $"Basic {auth}");
using var form = new MultipartFormDataContent();
var packageStream = File.OpenRead(Package);
// Just to be sure, load it into memory
var memoryStream = new MemoryStream();
await packageStream.CopyToAsync(memoryStream);
memoryStream.Seek(0, SeekOrigin.Begin);
form.Add(new StreamContent(memoryStream, (int)memoryStream.Length));
req.Content = form;
using var res = await http.SendAsync(req);
Console.WriteLine(res.StatusCode);
Console.WriteLine(await res.Content.ReadAsStringAsync()); Here's the file if you want to test. It's just a font and a JS in there for testing: |
I think a wireshark capture would be most useful here. Fiddler deals with HTTP requests and responses, but it doesn't give us enough information about what's happening within a single request, at the tcp packet level. Specifically, I'm curious at what point the "An established connection was aborted by the software in your host machine." error message is thrown. Was the header sent? Was the body started? did the body complete? How much of the file was sent? Was any response headers received? Wireshark, or any other packet capture, should tell us more. Sysinternals ProcMon might also be helpful, because it'll tell us about every file read and network read/write API call, so we can check if Windows is giving any additional information that .NET is losing. It won't give us as much TCP/HTTP information as wireshark, but it will tell us what position with the nupkg the filestream was at, and how many bytes were read/written to the TCP socket. We're also reaching out to .NET internally, to see if we can get any additional information. Finally, I downloaded your package, edited it to make the repo URL look like it's under my own account, and then I tried to push. But no matter what I try, I keep getting HTTP 401 unauthorized responses. I made the the token I saved has |
@zivkan oh I forgot to mention a small details, to check if it actually reached Github, I commented out the Authorization header (as you see in my code above) so I can see a 401 response but I didn't as well so apparently the response was cut even before authorization. If you get 401 response from using my code above, make sure you uncomment the Authorization header 😅 |
I wasn't using your test program, but just However, when I run Therefore @datvm, I can't reproduce your problem. Given the error message explicitly says "aborted by the software in your host machine", I'd like to reiterate that this appears to be an issue local to your machine. I don't understand why it only happens with the dotnet CLI and not with nuget.exe, that doesn't make sense to me. But if it's only happening on your machine, then it's not a .NET or NuGet issue, and the win32 error saying it's "your host machine" suggests it's some software issue on your machine, like anti-virus or firewall software. |
This issue has been automatically marked as stale because we have not received a response in 14 days. It will be closed if no further activity occurs within another 14 days of this comment. |
I've had the same issue with even bigger package (~6MB). The discussion under #9775 was fruitful for me. |
NuGet Product Used
dotnet.exe
Product Version
.NET 7.0.401, Nuget 6.7.0.127
Worked before?
No response
Impact
I'm unable to use this version
Repro Steps & Context
When pushing a relatively large (but in no way huge, about 3.4MB) Nuget package to a custom feed hosted by Github, it fails with the following error:
All retries fail as well.
HOWEVER, either using Nuget CLI client (downloaded at https://www.nuget.org/downloads) or manually crafting a PUT request using
cUrl
or HTTP client works well and the package is uploaded successfully. It only happens todotnet nuget
. This happens consistently and not randomly as well. I have two packages, it consistently uploads the smaller one successfully but fails on the bigger one. The successful standalonenuget
command is this:Further technical details
dotnet --info
:dotnet nuget --version
:nuget
version (the standalone one):Verbose Logs
No response
The text was updated successfully, but these errors were encountered: