gitea icon indicating copy to clipboard operation
gitea copied to clipboard

Use request timeout for git service rpc

Open parnic opened this issue 3 years ago • 3 comments

This enables git.Command's Run to optionally use the given context directly so its deadline will be respected. Otherwise, it falls back to the previous behavior of using the supplied timeout or a default timeout value of 360 seconds.

repo's serviceRPC() calls now use the context's deadline (which is unset/unlimited) instead of the default 6-minute timeout. This means that large repo clones will no longer arbitrarily time out on the upload-pack step, and pushes can take longer than 6 minutes on the receive-pack step.

Fixes #20680

parnic avatar Aug 05 '22 15:08 parnic

@wxiaoguang let me know if this is what you had in mind. I think this is going to end up with a game of whack-a-mole trying to identify which Run commands need to be using this.

parnic avatar Aug 05 '22 15:08 parnic

FYI: I think this PR is good and clear to fix the bug, and can be backported easily.

To make the Git module code clear, in the future there can be a refactor to remove both Timeout and UseContextTimeout, and make git.Run respects the context's deadline directly, then the whack-a-mole game can be avoided.

wxiaoguang avatar Aug 06 '22 02:08 wxiaoguang

Sounds good to me. I personally think this is an important fix for 1.17.1 since it can render people unable to push or pull when it trips.

parnic avatar Aug 06 '22 02:08 parnic

Please send backport

lafriks avatar Aug 06 '22 13:08 lafriks