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

Prevent context deadline error propagation in GetCommitsInfo #20346

Merged
merged 3 commits into from
Jul 13, 2022

Conversation

zeripath
Copy link
Contributor

@zeripath zeripath commented Jul 12, 2022

Although WalkGitLog tries to test for context.DeadlineExceeded
there is a small chance that the error will propagate to the reader
before it is recognised. This will cause the error to propagate up to
renderDirectoryFiles and cause a http status 500.

Here we check that the error passed is a DeadlineExceeded or if it
could be unwrapped to one.

Fix #20329

Signed-off-by: Andrew Thornton art27@cantab.net

Although `WalkGitLog` tries to test for `context.DeadlineExceededErr`
there is a small chance that the error will propagate to the reader
before it is recognised. This will cause the error to propagate up to
`renderDirectoryFiles` and cause a http status 500.

Here we check that the error passed is a `DeadlineExceededErr` or if it
could be unwrapped to one.

Fix go-gitea#20329

Signed-off-by: Andrew Thornton <art27@cantab.net>
@GiteaBot GiteaBot added the lgtm/need 1 This PR needs approval from one additional maintainer to be merged. label Jul 12, 2022
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jul 13, 2022
@6543
Copy link
Member

6543 commented Jul 13, 2022

🤖

@6543 6543 merged commit fe09ee5 into go-gitea:main Jul 13, 2022
6543 pushed a commit to 6543-forks/gitea that referenced this pull request Jul 13, 2022
…a#20346)

* Prevent context deadline error propagation in GetCommitsInfo

Although `WalkGitLog` tries to test for `context.DeadlineExceededErr`
there is a small chance that the error will propagate to the reader
before it is recognised. This will cause the error to propagate up to
`renderDirectoryFiles` and cause a http status 500.

Here we check that the error passed is a `DeadlineExceededErr` via error.Is

Fix go-gitea#20329

Signed-off-by: Andrew Thornton <art27@cantab.net>
@6543 6543 added the backport/done All backports for this PR have been created label Jul 13, 2022
@6543
Copy link
Member

6543 commented Jul 13, 2022

-> #20361

zeripath added a commit that referenced this pull request Jul 14, 2022
…#20361)

Backport #20346

Although `WalkGitLog` tries to test for `context.DeadlineExceededErr`
there is a small chance that the error will propagate to the reader
before it is recognised. This will cause the error to propagate up to
`renderDirectoryFiles` and cause a http status 500.

Here we check that the error passed is a `DeadlineExceededErr` via error.Is

Fix #20329

Signed-off-by: Andrew Thornton <art27@cantab.net>

Co-authored-by: zeripath <art27@cantab.net>
@zeripath zeripath deleted the fix-20329-context-deadline-exceeded-err branch July 14, 2022 02:48
zjjhot added a commit to zjjhot/gitea that referenced this pull request Jul 14, 2022
* giteaofficial/main:
  Fix icon margin in user/settings/repos (go-gitea#20281)
  Fix org label open count, including close count issue (go-gitea#20353)
  [skip ci] Updated translations via Crowdin
  Prevent context deadline error propagation in GetCommitsInfo (go-gitea#20346)
  Add missing return for when topic isn't found (go-gitea#20351)
  Upgrade to Node 18 on CI (go-gitea#20340)
  Fix checks in PR for empty commits go-gitea#19603 (go-gitea#20290)
  Use default values when provided values are empty (go-gitea#20318)
  Add tests for the host checking logic, clarify the behaviors (go-gitea#20328)
  Changelog for 1.16.9 (update) (go-gitea#20341) (go-gitea#20343)
  Fix various typos (go-gitea#20338)
  Correctly handle draft releases without a tag (go-gitea#20314)
  Add write check for creating Commit status (go-gitea#20332)
  Remove blue text on migrate page (go-gitea#20273)
  Updated dead link to Madeleine.js source (go-gitea#20322)
vsysoev pushed a commit to IntegraSDL/gitea that referenced this pull request Aug 10, 2022
…a#20346)

* Prevent context deadline error propagation in GetCommitsInfo

Although `WalkGitLog` tries to test for `context.DeadlineExceededErr`
there is a small chance that the error will propagate to the reader
before it is recognised. This will cause the error to propagate up to
`renderDirectoryFiles` and cause a http status 500.

Here we check that the error passed is a `DeadlineExceededErr` via error.Is

Fix go-gitea#20329

Signed-off-by: Andrew Thornton <art27@cantab.net>
@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport/done All backports for this PR have been created lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Context deadline exceeded
4 participants