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

http2 failure in UploadAsset #2113

Open
vchuravy opened this issue Oct 3, 2021 · 12 comments
Open

http2 failure in UploadAsset #2113

vchuravy opened this issue Oct 3, 2021 · 12 comments

Comments

@vchuravy
Copy link

vchuravy commented Oct 3, 2021

We are using ghr to upload binary assets from Github to CI.

Currently I am seeing an increased failure rate:

Failed to upload one of assets: one of the goroutines failed: failed to upload asset: /tmp/jl_A641Uc/Clang_assert.v12.0.1.x86_64-linux-gnu-cxx11.tar.gz: failed to upload release asset: /tmp/jl_A641Uc/Clang_assert.v12.0.1.x86_64-linux-gnu-cxx11.tar.gz: Post https://uploads.github.com/repos/JuliaBinaryWrappers/Clang_assert_jll.jl/releases/49230189/assets?name=Clang_assert.v12.0.1.x86_64-linux-gnu-cxx11.tar.gz: http2: Transport: cannot retry err [stream error: stream ID 117; REFUSED_STREAM] after Request.Body was written; define Request.GetBody to avoid this error

AFAIK ghr uses UploadAsset: https://github.com/tcnksm/ghr/blob/93494744e6930d13e5c052eac9ca64a6027779a4/github.go#L184 from https://github.com/tcnksm/ghr/blob/93494744e6930d13e5c052eac9ca64a6027779a4/github.go#L209

and the error looks like golang/go#25009

@gmlewis
Copy link
Collaborator

gmlewis commented Oct 3, 2021

Investigating... possibly related?
olivere/elastic#1443
https://sourcegraph.com/github.com/golang/net/-/commit/cffdcf672aee934982473246bc7e9a8ba446aa9b?visible=2

I remember we recently (<1year ago) made a couple changes with respect to the request:

but I'm not sure if these are related.

@vchuravy
Copy link
Author

vchuravy commented Oct 4, 2021

Turned out that is was hiding the actual errors:

Failed to upload one of assets: one of the goroutines failed: failed to upload asset: /tmp/jl_kxYk28/Clang_assert.v12.0.1.aarch64-apple-darwin.tar.gz: failed to upload release asset: /tmp/jl_kxYk28/Clang_assert.v12.0.1.aarch64-apple-darwin.tar.gz: Post https://uploads.github.com/repos/JuliaBinaryWrappers/Clang_assert_jll.jl/releases/49230189/assets?name=Clang_assert.v12.0.1.aarch64-apple-darwin.tar.gz: write tcp 128.30.92.237:33810->140.82.113.13:443: use of closed network connection
Failed to upload one of assets: one of the goroutines failed: failed to upload asset: /tmp/jl_kxYk28/Clang_assert.v12.0.1.x86_64-unknown-freebsd.tar.gz: failed to upload release asset: /tmp/jl_kxYk28/Clang_assert.v12.0.1.x86_64-unknown-freebsd.tar.gz: Post https://uploads.github.com/repos/JuliaBinaryWrappers/Clang_assert_jll.jl/releases/49230189/assets?name=Clang_assert.v12.0.1.x86_64-unknown-freebsd.tar.gz: write tcp 128.30.92.237:33988->140.82.113.13:443: use of closed network connection
Failed to upload one of assets: one of the goroutines failed: failed to upload asset: /tmp/jl_kxYk28/Clang_assert.v12.0.1.aarch64-linux-gnu-cxx11.tar.gz: failed to upload release asset: /tmp/jl_kxYk28/Clang_assert.v12.0.1.aarch64-linux-gnu-cxx11.tar.gz: Post https://uploads.github.com/repos/JuliaBinaryWrappers/Clang_assert_jll.jl/releases/49230189/assets?name=Clang_assert.v12.0.1.aarch64-linux-gnu-cxx11.tar.gz: write tcp 128.30.92.237:36032->140.82.114.14:443: write: broken pipe

@gmlewis
Copy link
Collaborator

gmlewis commented Oct 4, 2021

Glad you found it. Closing issue.

@gmlewis gmlewis closed this as completed Oct 4, 2021
@vchuravy
Copy link
Author

vchuravy commented Oct 9, 2021

I still think there is an issue here to be fixed. Upgrading to HTTP/2 shouldn't have swallowed these error messages.

@gmlewis gmlewis reopened this Oct 10, 2021
@gmlewis
Copy link
Collaborator

gmlewis commented Oct 10, 2021

Is anyone able to write a unit test that demonstrates the problem?

@wangyoucao577
Copy link

any update on this?

@caarlos0
Copy link
Contributor

FWIW this happens occasionally for some goreleaser users as well (using v39).

goreleaser/goreleaser#2746

@cpanato
Copy link
Contributor

cpanato commented Apr 5, 2022

having the same issue when using goreleaser

@blacktop
Copy link

Still getting this error

@Zangetsu38
Copy link

i have same, i using recreate but it said already exist...

--> Uploading: app_compat_db.xml
Failed to upload one of assets: one of the goroutines failed: failed to upload asset: D:\a\compatibility\compatibility\app_compat_db.xml: failed to upload release asset: D:\a\compatibility\compatibility\app_compat_db.xml: POST https://uploads.github.com/repos/Vita3K/compatibility/releases/92110749/assets?name=app_compat_db.xml: 422 Validation Failed [{Resource:ReleaseAsset Field:name Code:already_exists Message:}]

@gmlewis
Copy link
Collaborator

gmlewis commented Feb 12, 2023

According to the official documentation here: https://docs.github.com/en/rest/releases/assets?apiVersion=2022-11-28#upload-a-release-asset

If you upload an asset with the same filename as another uploaded asset, you'll receive an error and must delete the old file before you can re-upload the new asset.

So I don't believe these reported errors are a fault of this client library, as the GitHub v3 API provides no apparent mechanism to overwrite an existing file using UploadReleaseAsset.

@ysmilda
Copy link

ysmilda commented Sep 20, 2024

Running into the same issue, from what I gather the only "fix" is to wait and hope that this behaviour passes?

In my use case I create a release via client.Repositories.CreateRelease and with the release ID that I retrieve from there I try to upload a file using client.Repositories.UploadReleaseAsset after which I get an

http2: Transport: cannot retry err [stream error: stream ID 1; PROTOCOL_ERROR; received from peer] after Request.Body was written; define Request.GetBody to avoid this error

error every single time (so far). Seeing the above comment mentions files with the same name, that is not the case here as no assets have been uploaded yet.

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

8 participants