Nuget package push fails with 'Connection reset by peer' #9856

Closed
opened 2025-11-02 08:51:29 -06:00 by GiteaMirror · 5 comments
Owner

Originally created by @artprk on GitHub (Nov 18, 2022).

Description

Assumption

It seems, that NuGet Packages Repository rejects big packages

Steps to reproduce

Tune log in app.ini on gitea server

[log]
LEVEL     = trace

Get packages from nuget.org

sudo apt install dotnet-sdk-6.0

mkdir test && cd test

dotnet new console
dotnet add package --package-directory . --version 2.46.3 grpc.core

Add a local source

dotnet nuget add source --name gitea --username gitea --password 123456 --store-password-in-clear-text https://gitea.my.local/api/packages/gitea/nuget/index.json

Try to push a bigger package (17M) to a local source

dotnet nuget push --source gitea grpc.core.2.46.3.nupkg

Errors in console

warn : No API Key was provided and no API Key could be found for 'https://gitea.my.local/api/packages/gitea/nuget'. To save an API Key for a source use the 'setApiKey' command.
Pushing grpc.core.2.46.3.nupkg to 'https://gitea.my.local/api/packages/gitea/nuget'...
  PUT https://gitea.my.local/api/packages/gitea/nuget/
An error was encountered when fetching 'PUT https://gitea.my.local/api/packages/gitea/nuget/'. The request will now be retried.
Error while copying content to a stream.
  Unable to write data to the transport connection: Connection reset by peer.
  Connection reset by peer
  PUT https://gitea.my.local/api/packages/gitea/nuget/
An error was encountered when fetching 'PUT https://gitea.my.local/api/packages/gitea/nuget/'. The request will now be retried.
Error while copying content to a stream.
  Unable to write data to the transport connection: Connection reset by peer.
  Connection reset by peer
  PUT https://gitea.my.local/api/packages/gitea/nuget/
error: Error while copying content to a stream.
error:   Unable to write data to the transport connection: Connection reset by peer.
error:   Connection reset by peer


Usage: ...

Errors in gitea log

2022/11/18 18:03:00 [6377c8d4] router: started   GET /api/packages/gitea/nuget/index.json for 192.168.16.254:51633
2022/11/18 18:03:00 ...ckages/conan/auth.go:26:Verify() [T] [6377c8d4] ParseAuthorizationToken: no token
2022/11/18 18:03:00 [6377c8d4] router: completed GET /api/packages/gitea/nuget/index.json for 192.168.16.254:51633, 200 OK in 2.3ms @ nuget/nuget.go:72(nuget.ServiceIndexV3)
2022/11/18 18:03:00 [6377c8d4-2] router: started   PUT /api/packages/gitea/nuget/ for 192.168.16.254:51633
2022/11/18 18:03:00 ...ckages/conan/auth.go:26:Verify() [T] [6377c8d4-2] ParseAuthorizationToken: no token
2022/11/18 18:03:00 [6377c8d4-2] router: completed PUT /api/packages/gitea/nuget/ for 192.168.16.254:51633, 401 Unauthorized in 1.5ms @ packages/api.go:34(packages.reqPackageAccess)
2022/11/18 18:03:01 [6377c8d5] router: started   PUT /api/packages/gitea/nuget/ for 192.168.16.254:51634
2022/11/18 18:03:01 ...ckages/conan/auth.go:26:Verify() [T] [6377c8d5] ParseAuthorizationToken: no token
2022/11/18 18:03:01 [6377c8d5] router: completed PUT /api/packages/gitea/nuget/ for 192.168.16.254:51634, 401 Unauthorized in 1.6ms @ packages/api.go:34(packages.reqPackageAccess)
2022/11/18 18:03:02 [6377c8d6] router: started   PUT /api/packages/gitea/nuget/ for 192.168.16.254:51635
2022/11/18 18:03:02 ...ckages/conan/auth.go:26:Verify() [T] [6377c8d6] ParseAuthorizationToken: no token
2022/11/18 18:03:02 [6377c8d6] router: completed PUT /api/packages/gitea/nuget/ for 192.168.16.254:51635, 401 Unauthorized in 2.0ms @ packages/api.go:34(packages.reqPackageAccess)

But, try to push a smaller package (276K)

dotnet nuget push --source gitea grpc.core.api/2.46.3/grpc.core.api.2.46.3.nupkg

Success in console

warn : No API Key was provided and no API Key could be found for 'https://gitea.my.local/api/packages/gitea/nuget'. To save an API Key for a source use the 'setApiKey' command.
Pushing grpc.core.api.2.46.3.nupkg to 'https://gitea.my.local/api/packages/gitea/nuget'...
  PUT https://gitea.my.local/api/packages/gitea/nuget/
  Created https://gitea.my.local/api/packages/gitea/nuget/ 1237ms
Your package was pushed.

Despite of the same 401 error in gitea log

2022/11/18 18:05:21 [6377c961] router: started   PUT /api/packages/gitea/nuget/ for 192.168.16.254:51637
2022/11/18 18:05:21 ...ckages/conan/auth.go:26:Verify() [T] [6377c961] ParseAuthorizationToken: no token
2022/11/18 18:05:21 [6377c961] router: completed PUT /api/packages/gitea/nuget/ for 192.168.16.254:51637, 401 Unauthorized in 1.6ms @ packages/api.go:34(packages.reqPackageAccess)
2022/11/18 18:05:21 [6377c961-2] router: started   PUT /api/packages/gitea/nuget/ for 192.168.16.254:51638
2022/11/18 18:05:21 ...rvices/auth/basic.go:67:Verify() [T] [6377c961-2] Basic Authorization: Attempting login for: gitea
2022/11/18 18:05:21 ...rvices/auth/basic.go:112:Verify() [T] [6377c961-2] Basic Authorization: Attempting SignIn for gitea
2022/11/18 18:05:21 ...rvices/auth/basic.go:125:Verify() [T] [6377c961-2] Basic Authorization: Logged in user 1:gitea
2022/11/18 18:05:21 ...packages/packages.go:114:createPackageAndVersion() [T] [6377c961-2] Creating package: 1, 2, nuget, Grpc.Core.Api, 2.46.3, map[], map[], false
2022/11/18 18:05:21 ...packages/packages.go:228:addFileToPackageVersion() [T] [6377c961-2] Adding package file: 797, grpc.core.api.2.46.3.nupkg
2022/11/18 18:05:21 router: completed PUT /api/packages/gitea/nuget/ for 192.168.16.254:51638, 201 Created in 111.3ms @ nuget/nuget.go:350(nuget.UploadPackage)

Gitea Version

1.18.0-rc0

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

Ubuntu 22.04 LTS

How are you running Gitea?

Get an image from hub.docker.com

sudo docker pull gitea/gitea:1.18.0-rc0

Run with a script

$ cat run-gitea-1.18.sh
GITEA_HOME=/home/art/gitea/data

sudo docker run --detach \
  --dns 192.168.10.10 \
  --publish 192.168.16.16:80:3000 \
  --publish 192.168.16.16:443:3001 \
  --name gitea \
  --restart always \
  --volume $GITEA_HOME:/data \
  --env USER_UID=1000 \
  --env USER_GID=1000 \
  --env RUN_MODE=prod \
  --env OFFLINE_MODE=true \
  --env DISABLE_GRAVATAR=true \
  --shm-size 256m \
  gitea/gitea:1.18.0-rc0

Database

SQLite

Originally created by @artprk on GitHub (Nov 18, 2022). ### Description ### Assumption It seems, that NuGet Packages Repository rejects big packages ### Steps to reproduce Tune log in app.ini on gitea server ``` [log] LEVEL = trace ``` Get packages from nuget.org ``` sudo apt install dotnet-sdk-6.0 mkdir test && cd test dotnet new console dotnet add package --package-directory . --version 2.46.3 grpc.core ``` Add a local source ``` dotnet nuget add source --name gitea --username gitea --password 123456 --store-password-in-clear-text https://gitea.my.local/api/packages/gitea/nuget/index.json ``` Try to push a bigger package (17M) to a local source ``` dotnet nuget push --source gitea grpc.core.2.46.3.nupkg ``` Errors in console ``` warn : No API Key was provided and no API Key could be found for 'https://gitea.my.local/api/packages/gitea/nuget'. To save an API Key for a source use the 'setApiKey' command. Pushing grpc.core.2.46.3.nupkg to 'https://gitea.my.local/api/packages/gitea/nuget'... PUT https://gitea.my.local/api/packages/gitea/nuget/ An error was encountered when fetching 'PUT https://gitea.my.local/api/packages/gitea/nuget/'. The request will now be retried. Error while copying content to a stream. Unable to write data to the transport connection: Connection reset by peer. Connection reset by peer PUT https://gitea.my.local/api/packages/gitea/nuget/ An error was encountered when fetching 'PUT https://gitea.my.local/api/packages/gitea/nuget/'. The request will now be retried. Error while copying content to a stream. Unable to write data to the transport connection: Connection reset by peer. Connection reset by peer PUT https://gitea.my.local/api/packages/gitea/nuget/ error: Error while copying content to a stream. error: Unable to write data to the transport connection: Connection reset by peer. error: Connection reset by peer Usage: ... ``` Errors in gitea log ``` 2022/11/18 18:03:00 [6377c8d4] router: started GET /api/packages/gitea/nuget/index.json for 192.168.16.254:51633 2022/11/18 18:03:00 ...ckages/conan/auth.go:26:Verify() [T] [6377c8d4] ParseAuthorizationToken: no token 2022/11/18 18:03:00 [6377c8d4] router: completed GET /api/packages/gitea/nuget/index.json for 192.168.16.254:51633, 200 OK in 2.3ms @ nuget/nuget.go:72(nuget.ServiceIndexV3) 2022/11/18 18:03:00 [6377c8d4-2] router: started PUT /api/packages/gitea/nuget/ for 192.168.16.254:51633 2022/11/18 18:03:00 ...ckages/conan/auth.go:26:Verify() [T] [6377c8d4-2] ParseAuthorizationToken: no token 2022/11/18 18:03:00 [6377c8d4-2] router: completed PUT /api/packages/gitea/nuget/ for 192.168.16.254:51633, 401 Unauthorized in 1.5ms @ packages/api.go:34(packages.reqPackageAccess) 2022/11/18 18:03:01 [6377c8d5] router: started PUT /api/packages/gitea/nuget/ for 192.168.16.254:51634 2022/11/18 18:03:01 ...ckages/conan/auth.go:26:Verify() [T] [6377c8d5] ParseAuthorizationToken: no token 2022/11/18 18:03:01 [6377c8d5] router: completed PUT /api/packages/gitea/nuget/ for 192.168.16.254:51634, 401 Unauthorized in 1.6ms @ packages/api.go:34(packages.reqPackageAccess) 2022/11/18 18:03:02 [6377c8d6] router: started PUT /api/packages/gitea/nuget/ for 192.168.16.254:51635 2022/11/18 18:03:02 ...ckages/conan/auth.go:26:Verify() [T] [6377c8d6] ParseAuthorizationToken: no token 2022/11/18 18:03:02 [6377c8d6] router: completed PUT /api/packages/gitea/nuget/ for 192.168.16.254:51635, 401 Unauthorized in 2.0ms @ packages/api.go:34(packages.reqPackageAccess) ``` But, try to push a smaller package (276K) ``` dotnet nuget push --source gitea grpc.core.api/2.46.3/grpc.core.api.2.46.3.nupkg ``` Success in console ``` warn : No API Key was provided and no API Key could be found for 'https://gitea.my.local/api/packages/gitea/nuget'. To save an API Key for a source use the 'setApiKey' command. Pushing grpc.core.api.2.46.3.nupkg to 'https://gitea.my.local/api/packages/gitea/nuget'... PUT https://gitea.my.local/api/packages/gitea/nuget/ Created https://gitea.my.local/api/packages/gitea/nuget/ 1237ms Your package was pushed. ``` Despite of the same 401 error in gitea log ``` 2022/11/18 18:05:21 [6377c961] router: started PUT /api/packages/gitea/nuget/ for 192.168.16.254:51637 2022/11/18 18:05:21 ...ckages/conan/auth.go:26:Verify() [T] [6377c961] ParseAuthorizationToken: no token 2022/11/18 18:05:21 [6377c961] router: completed PUT /api/packages/gitea/nuget/ for 192.168.16.254:51637, 401 Unauthorized in 1.6ms @ packages/api.go:34(packages.reqPackageAccess) 2022/11/18 18:05:21 [6377c961-2] router: started PUT /api/packages/gitea/nuget/ for 192.168.16.254:51638 2022/11/18 18:05:21 ...rvices/auth/basic.go:67:Verify() [T] [6377c961-2] Basic Authorization: Attempting login for: gitea 2022/11/18 18:05:21 ...rvices/auth/basic.go:112:Verify() [T] [6377c961-2] Basic Authorization: Attempting SignIn for gitea 2022/11/18 18:05:21 ...rvices/auth/basic.go:125:Verify() [T] [6377c961-2] Basic Authorization: Logged in user 1:gitea 2022/11/18 18:05:21 ...packages/packages.go:114:createPackageAndVersion() [T] [6377c961-2] Creating package: 1, 2, nuget, Grpc.Core.Api, 2.46.3, map[], map[], false 2022/11/18 18:05:21 ...packages/packages.go:228:addFileToPackageVersion() [T] [6377c961-2] Adding package file: 797, grpc.core.api.2.46.3.nupkg 2022/11/18 18:05:21 router: completed PUT /api/packages/gitea/nuget/ for 192.168.16.254:51638, 201 Created in 111.3ms @ nuget/nuget.go:350(nuget.UploadPackage) ``` ### Gitea Version 1.18.0-rc0 ### Can you reproduce the bug on the Gitea demo site? Yes ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version _No response_ ### Operating System Ubuntu 22.04 LTS ### How are you running Gitea? Get an image from hub.docker.com ``` sudo docker pull gitea/gitea:1.18.0-rc0 ``` Run with a script ``` $ cat run-gitea-1.18.sh GITEA_HOME=/home/art/gitea/data sudo docker run --detach \ --dns 192.168.10.10 \ --publish 192.168.16.16:80:3000 \ --publish 192.168.16.16:443:3001 \ --name gitea \ --restart always \ --volume $GITEA_HOME:/data \ --env USER_UID=1000 \ --env USER_GID=1000 \ --env RUN_MODE=prod \ --env OFFLINE_MODE=true \ --env DISABLE_GRAVATAR=true \ --shm-size 256m \ gitea/gitea:1.18.0-rc0 ``` ### Database SQLite
GiteaMirror added the topic/packagesissue/needs-feedback labels 2025-11-02 08:51:29 -06:00
Author
Owner

@maxxie85 commented on GitHub (Mar 14, 2023):

Try adding a API key in your push argument

dotnet nuget push --api-key {YOUR_API_KEY} --source gitea grpc.core.api/2.46.3/grpc.core.api.2.46.3.nupkg

Usage: dotnet nuget push [arguments] [options]

Arguments:
  [root]  Specify the path to the package and your API key to push the package to the server.

Options:
  -h|--help                      Show help information
  --force-english-output         Forces the application to run using an invariant, English-based culture.
  -s|--source <source>           Package source (URL, UNC/folder path or package source name) to use. Defaults to DefaultPushSource if specified in NuGet.Config.
  -ss|--symbol-source <source>   Symbol server URL to use.
  -t|--timeout <timeout>         Timeout for pushing to a server in seconds. Defaults to 300 seconds (5 minutes).
  -k|--api-key <apiKey>          The API key for the server.
  -sk|--symbol-api-key <apiKey>  The API key for the symbol server.
  -d|--disable-buffering         Disable buffering when pushing to an HTTP(S) server to decrease memory usage.
  -n|--no-symbols                If a symbols package exists, it will not be pushed to a symbols server.
  --no-service-endpoint          Does not append "api/v2/package" to the source URL.
  --interactive                  Allow the command to block and require manual action for operations like authentication.
  --skip-duplicate               If a package and version already exists, skip it and continue with the next package in the push, if any.
@maxxie85 commented on GitHub (Mar 14, 2023): Try adding a API key in your push argument `dotnet nuget push --api-key {YOUR_API_KEY} --source gitea grpc.core.api/2.46.3/grpc.core.api.2.46.3.nupkg` ``` Usage: dotnet nuget push [arguments] [options] Arguments: [root] Specify the path to the package and your API key to push the package to the server. Options: -h|--help Show help information --force-english-output Forces the application to run using an invariant, English-based culture. -s|--source <source> Package source (URL, UNC/folder path or package source name) to use. Defaults to DefaultPushSource if specified in NuGet.Config. -ss|--symbol-source <source> Symbol server URL to use. -t|--timeout <timeout> Timeout for pushing to a server in seconds. Defaults to 300 seconds (5 minutes). -k|--api-key <apiKey> The API key for the server. -sk|--symbol-api-key <apiKey> The API key for the symbol server. -d|--disable-buffering Disable buffering when pushing to an HTTP(S) server to decrease memory usage. -n|--no-symbols If a symbols package exists, it will not be pushed to a symbols server. --no-service-endpoint Does not append "api/v2/package" to the source URL. --interactive Allow the command to block and require manual action for operations like authentication. --skip-duplicate If a package and version already exists, skip it and continue with the next package in the push, if any. ```
Author
Owner

@lunny commented on GitHub (Mar 14, 2023):

Please upgrade to 1.18.5 and try again.

@lunny commented on GitHub (Mar 14, 2023): Please upgrade to 1.18.5 and try again.
Author
Owner

@techknowlogick commented on GitHub (Mar 14, 2023):

Which reverse proxy are you using (if any)?

@techknowlogick commented on GitHub (Mar 14, 2023): Which reverse proxy are you using (if any)?
Author
Owner

@wxiaoguang commented on GitHub (Apr 23, 2023):

1.19 has many new fixes. Does it still have the problem?

@wxiaoguang commented on GitHub (Apr 23, 2023): 1.19 has many new fixes. Does it still have the problem?
Author
Owner

@wxiaoguang commented on GitHub (Apr 26, 2023):

No more feedback, I think this issue can be closed, feel free to reopen if there are more clues.

@wxiaoguang commented on GitHub (Apr 26, 2023): No more feedback, I think this issue can be closed, feel free to reopen if there are more clues.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#9856