Skip to content

ssh: Improve errors for fetches canceled by the user

Patrick Steinhardt requested to merge pks-ssh-upload-pack-canceled-fetches into master

In recent weeks we have started to see an uptick of incidents caused by a single user that was repeatedly fetching from a specific repository via the SSHUploadPackWithSidechannel RPC. The error has always been the same:

fatal: the remote hung up unexpectedly

This error is returned by git-upload-pack(1) in case it sees a short read of data and ultimately indicates that the user has probably killed git-fetch(1). This is not an actionable error on our side as it is a totally expected outcome that a killed fetch will cause the fetch to fail.

Now that we have a lot more tests in this area we can be reasonably sure that short reads on an otherwise normally closed network connection is seemingly the only condition that causes the above error. So let's put a gRPC error code of Canceled on this error so that it doesn't cause our alerts to go off anymore.

Changelog: fixed

Supersedes !4722 (closed).

Fixes #4331 (closed).

Merge request reports