mirror of
https://github.com/go-gitea/gitea.git
synced 2026-07-16 04:42:51 -05:00
Locked out of the ability to comment on the code of a PR sometimes #5739
Closed
opened 2025-11-02 06:34:34 -06:00 by GiteaMirror
·
18 comments
No Branch/Tag Specified
main
release/v1.25
release/v1.24
release/v1.23
release/v1.22
release/v1.21
release/v1.20
release/v1.19
release/v1.18
release/v1.17
release/v1.16
release/v1.15
release/v1.14
release/v1.13
release/v1.12
release/v1.11
release/v1.10
release/v1.9
release/v1.8
v1.25.3
v1.25.2
v1.25.1
v1.25.0
v1.24.7
v1.25.0-rc0
v1.26.0-dev
v1.24.6
v1.24.5
v1.24.4
v1.24.3
v1.24.2
v1.24.1
v1.24.0
v1.23.8
v1.24.0-rc0
v1.25.0-dev
v1.23.7
v1.23.6
v1.23.5
v1.23.4
v1.23.3
v1.23.2
v1.23.1
v1.23.0
v1.23.0-rc0
v1.24.0-dev
v1.22.6
v1.22.5
v1.22.4
v1.22.3
v1.22.2
v1.22.1
v1.22.0
v1.23.0-dev
v1.22.0-rc1
v1.21.11
v1.22.0-rc0
v1.21.10
v1.21.9
v1.21.8
v1.21.7
v1.21.6
v1.21.5
v1.21.4
v1.21.3
v1.21.2
v1.20.6
v1.21.1
v1.21.0
v1.21.0-rc2
v1.21.0-rc1
v1.20.5
v1.22.0-dev
v1.21.0-rc0
v1.20.4
v1.20.3
v1.20.2
v1.20.1
v1.20.0
v1.19.4
v1.21.0-dev
v1.20.0-rc2
v1.20.0-rc1
v1.20.0-rc0
v1.19.3
v1.19.2
v1.19.1
v1.19.0
v1.19.0-rc1
v1.20.0-dev
v1.19.0-rc0
v1.18.5
v1.18.4
v1.18.3
v1.18.2
v1.18.1
v1.18.0
v1.17.4
v1.18.0-rc1
v1.19.0-dev
v1.18.0-rc0
v1.17.3
v1.17.2
v1.17.1
v1.17.0
v1.17.0-rc2
v1.16.9
v1.17.0-rc1
v1.18.0-dev
v1.16.8
v1.16.7
v1.16.6
v1.16.5
v1.16.4
v1.16.3
v1.16.2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v1.4.0-rc1
v1.3.2
v1.3.1
v1.3.0
v1.3.0-rc2
v1.3.0-rc1
v1.2.3
v1.2.2
v1.2.1
v1.2.0
v1.2.0-rc3
v1.2.0-rc2
v1.1.4
v1.2.0-rc1
v1.1.3
v1.1.2
v1.1.1
v1.1.0
v1.0.2
v1.0.1
v1.0.0
v0.9.99
Labels
Clear labels
$20
$250
$50
$500
backport/done
💎 Bounty
docs-update-needed
good first issue
hacktoberfest
issue/bounty
issue/confirmed
issue/critical
issue/duplicate
issue/needs-feedback
issue/not-a-bug
issue/regression
issue/stale
issue/workaround
lgtm/need 2
modifies/api
modifies/translation
outdated/backport/v1.18
outdated/theme/markdown
outdated/theme/timetracker
performance/bigrepo
performance/cpu
performance/memory
performance/speed
pr/breaking
proposal/accepted
proposal/rejected
pr/wip
pull-request
reviewed/wontfix
💰 Rewarded
skip-changelog
status/blocked
topic/accessibility
topic/api
topic/authentication
topic/build
topic/code-linting
topic/commit-signing
topic/content-rendering
topic/deployment
topic/distribution
topic/federation
topic/gitea-actions
topic/issues
topic/lfs
topic/mobile
topic/moderation
topic/packages
topic/pr
topic/projects
topic/repo
topic/repo-migration
topic/security
topic/theme
topic/ui
topic/ui-interaction
topic/ux
topic/webhooks
topic/wiki
type/bug
type/deprecation
type/docs
type/enhancement
type/feature
type/miscellaneous
type/proposal
type/question
type/refactoring
type/summary
type/testing
type/upstream
Mirrored from GitHub Pull Request
Milestone
No items
No Milestone
Projects
Clear projects
No project
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/gitea#5739
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @parnic-sks on GitHub (Jul 13, 2020).
[x]):Description
We are using Gitea on a small team (5 programmers) and fairly regularly run into a case where the "Files Changed" tab on a pull request is no longer accessible with some variation on this error message:
1.12.2:
1.12.1:
We have sometimes been able to find the offending comment in the database and update its Review ID to the appropriate ID. This gets difficult when a lot of comments have been made on other PRs between noticing the problem and trying to fix it.
We don't have a specific reproduction case that triggers this, but in general it seems it is sometimes possible to fail to assign the appropriate review ID in a comment which then breaks the ability to review changes line-by-line on a given PR.
Screenshots
Nothing to show, really, since it's just an error. Loading the Files Changed tab attempts to GET /org/repo/pulls/:pull_id/files, which returns 500 and the above error as plain text.
@aloosley commented on GitHub (Jul 14, 2020):
I seem to have something similar. After commenting for a while on the
Files Changedpage, this eventually displayed in my browser:I don't recall any comment being anything special other than containing some code snippets and a weblink. Now I cannot access that part of the PR anymore :-(.
@lafriks commented on GitHub (Jul 14, 2020):
To what review ID that comment was pointing to (other PR/repo)?
@aloosley commented on GitHub (Jul 15, 2020):
I don't know, I was using the
Add single commentbutton every time. Do you have any hint on how to get that info?Later in the day, I decided to avoid the
Add single commentbutton by writing a bunch of comments in a single review submission instead. Later I got a 500 error when I tried to submit the review.We have since downgraded 1.11.3 (the version we had before upgrading to 1.12.0/1), I've tried all the review / comment functionality and everything seems to work fine again.
We upgraded simply by pulling the new docker image and starting it on top of our pre-existing gitea database. Is it possible the database from 1.11.3 are not compatible with 1.12.0/1?
@parnic-sks commented on GitHub (Jul 15, 2020):
For our case, the comment should have been pointing at PR 35, internal review id 192 or something. I think, based on perusing the pgsql database a bit, that the review ID is actually set to 0 on the offending comment.
This is how most of our review comments are done as well.
We see this occasionally as well, usually when the code has changed between the time the PR was loaded and the comment was submitted, but we see it other times as well.
1.12.1 was the first version we installed and we are seeing the issue, so I think it's unlikely to be a db upgrade bug.
@lafriks commented on GitHub (Jul 15, 2020):
Thanks, will try to reproduce
@tanrui8765 commented on GitHub (Jul 22, 2020):
having the same problem as well. I added several pieces of comments with
Add single comment, then click onFile Changedtab, problem appeared.template: repo/diff/box:152:65: executing "repo/diff/box" at <0>: nil pointer evaluating *models.Review.TypeI am using Gitea 1.12.2, too. Windows Server 2008, MySQL.
@svenseeberg commented on GitHub (Jul 30, 2020):
I can confirm that the issue exists on on Gitea 1.12.3. with sqlite. It worked after creation of the PR, but broke after 1 or 2 inline comments were added. So I guess there is an issue with rendering already existing comments?
Also, one user noted that his comments were not visible at all in the beginning. Not sure if this is related or reproducible.
@bendem commented on GitHub (Aug 4, 2020):
Having the same issue, let me know if there is anything I can do to help debug this.
@zeripath commented on GitHub (Aug 4, 2020):
I initially was wondering if this was some issue with a certain number of reviews but I just added >80 reviews to a PR on my test instance and it hasn't failed (albeit this is on master/1.13) Is anyone able to confirm that the bug is not present on master/try?
I would guess that at least a temporary solution would involve monkey patching the template repo/diff/box.tmpl to prevent the NPE around line 152.
@singalen commented on GitHub (Aug 5, 2020):
Very stable to reproduce here: https://try.gitea.io/hardi/pull-request-test/pulls/1/files
@zeripath commented on GitHub (Aug 5, 2020):
Cool that means it's definitely not just a 1.12 issue. It's really weird that I can't forcibly reproduce on my dev machine
@parnic-sks commented on GitHub (Aug 5, 2020):
Thank you! I'll update the original post with this link.
@zeripath commented on GitHub (Aug 5, 2020):
This is interesting - I can't replicate it on my dev box but if you look at the API you see an interesting finding:
Vs a sort of equivalent:
Note the commit_id is empty on the broken try instance.
@Ahaus314 commented on GitHub (Aug 11, 2020):
We got this error as well in 1.12.1. Only few persons reported this to us, maybe the amount of people having this is greater than I am aware of.
@mrsdizzie commented on GitHub (Aug 11, 2020):
I think I've tracked this down --
To reproduce:
1: Comment on a specific line of a PR
2: Make a commit that changes the line and automatically marks the previous comments as outdated (per https://github.com/go-gitea/gitea/pull/9532)
3: Go back to files view which now doesn't show previous review
4: Leave a comment on the same line as previous
See error above
So this process causes new comments to be created with a reviewID of 0 which then triggers the NPE above because the comment will have no review loaded.
Seems to be this bit:
74bd9691c6/services/pull/review.go (L32-L37)Will see the previous comment that has been invalidated by a commit because it only looks to see if there is an existing comment at that line.
Then here:
74bd9691c6/services/pull/review.go (L40-L54)It leaves a comment with replyReviewID instead of trying to load the actual review and use that ID because it thinks one already exists and this is just a comment. Not sure, but replyReviewID appears to always be 0 from here:
74bd9691c6/routers/repo/pull_review.go (L38-L48)(form.Reply)
Perhaps this:
74bd9691c6/models/review.go (L265-L268)Should check for comment.invalidated as well? Not sure how this is supposed to work but that seems to be what causes the bug. Also would probably need something to either fix what will now be broken comments or change the template to ignore them and avoid this error...
@zeripath commented on GitHub (Aug 20, 2020):
Here's a quick patch to prevent the NPE whilst we fix the underlying issue.
@zeripath commented on GitHub (Aug 20, 2020):
Hmm, If we turn this:
74bd9691c6/services/pull/review.go (L32)to:
This will prevent the issue.
Current suggested patch
@zeripath commented on GitHub (Aug 22, 2020):
Apologies that this took so long to fix.