go-github icon indicating copy to clipboard operation
go-github copied to clipboard

http2 failure in `UploadAsset`

Open vchuravy opened this issue 4 years ago • 12 comments

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 https://github.com/golang/go/issues/25009

vchuravy avatar Oct 03 '21 17:10 vchuravy

Investigating... possibly related? https://github.com/olivere/elastic/issues/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:

  • https://github.com/google/go-github/pull/1645
  • https://github.com/google/go-github/pull/1576

but I'm not sure if these are related.

gmlewis avatar Oct 03 '21 19:10 gmlewis

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

vchuravy avatar Oct 04 '21 16:10 vchuravy

Glad you found it. Closing issue.

gmlewis avatar Oct 04 '21 18:10 gmlewis

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

vchuravy avatar Oct 09 '21 23:10 vchuravy

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

gmlewis avatar Oct 10 '21 01:10 gmlewis

any update on this?

wangyoucao577 avatar Nov 04 '21 12:11 wangyoucao577

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

https://github.com/goreleaser/goreleaser/issues/2746

caarlos0 avatar Dec 28 '21 12:12 caarlos0

having the same issue when using goreleaser

cpanato avatar Apr 05 '22 13:04 cpanato

Still getting this error

blacktop avatar Nov 29 '22 01:11 blacktop

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:}]

Zangetsu38 avatar Feb 11 '23 23:02 Zangetsu38

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.

gmlewis avatar Feb 12 '23 00:02 gmlewis