mirror of
https://github.com/go-gitea/gitea.git
synced 2026-03-12 10:39:38 -05:00
500 when adding review comments on specific lines for PR:s #3499
Closed
opened 2025-11-02 05:15:00 -06:00 by GiteaMirror
·
26 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
v1.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.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#3499
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 @AntiSC2 on GitHub (Jun 20, 2019).
[x]):[Macaron] 2019-06-20 16:08:16: Started POST /MyTeam/MyRepo/pulls/19/files/reviews/comments for 172.16.2.1022019/06/20 16:08:16 http: superfluous response.WriteHeader call from code.gitea.io/gitea/vendor/gopkg.in/macaron%2ev1.(*responseWriter).WriteHeader (response_writer.go:59)[Macaron] 2019-06-20 16:08:16: Completed POST /MyTeam/MyRepo/pulls/19/files/reviews/comments 302 Found in 57.718947msDescription
I get a 500 internal server error sometimes when adding review comments to specific lines for a PR. I haven't figured the pattern yet because it only happens on specific lines of the files. But once I find a line that causes the 500 internal server error then it happens every time.
It could be related to #6236 as the files we work in are not in UTF-8 but instead in iso-8859-15 and we use the swedish characters Å, Ä and Ö but I'm not getting the same error message in the log so therefore I'm creating a new issue.
If it's relevant I started running the server on version on 1.7.0 and has since upgraded to 1.8.1 and then 1.8.2
The repo and the files are related to my work so I can't share those publicly.
Screenshots
@AntiSC2 commented on GitHub (Jul 9, 2019):
Update: It doesn't seem to depend on Å, Ä, or Ö. I can get a 500 on other lines as well. Have tried recreating the problem on try.gitea.io but to no avail.
@AntiSC2 commented on GitHub (Jul 9, 2019):
It also only happens when doing a review, adding a single comment works fine.
@AntiSC2 commented on GitHub (Jul 16, 2019):
When 1.9.0 is released I'm going to update to it and see if the issue still remains then.
@kstruessmann commented on GitHub (Sep 6, 2019):
i can confirm this issue still remains on 1.9.2
@lunny commented on GitHub (Sep 6, 2019):
@kstruessmann could you confirm that on https://try.gitea.io ?
@kstruessmann commented on GitHub (Sep 6, 2019):
I can't reproduce the error on https://try.gitea.io.
The issue acts a bit weird. It only happens to some users and if so it persists for them the whole PR. Other users can comment with no problems.
I also can't reproduce the error in our own testing server. The only difference there is an LDAP authentication in the production server.
We noticed no difference if the users connect directly to get or use the reverse-proxy.
@pavelpage commented on GitHub (Sep 8, 2019):
The problem also appears when your first comment some line on the pull request(95 line for example), then push some changes whice makes file a bit shorter( for example 90 lines at all). After that, if you try to answer to previous comment you will see 500 code("some file has only 90 lines"). It means that you can comment specific lines, but if you chang files the system won't remember it, it can only see the current stage of file.
Just try to answer to this comment
https://try.gitea.io/pavel/test/pulls/1#issuecomment-12940
You will see 500 error.
@guillep2k commented on GitHub (Sep 8, 2019):
Adding a comment didn't trigger the problem. Replying to the review did.
@stale[bot] commented on GitHub (Nov 7, 2019):
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.
@guillep2k commented on GitHub (Nov 7, 2019):
I hit this bug from time to time. I also have repos with non utf-8 content, and I think that's the reason why it happens.
@zeripath commented on GitHub (Nov 9, 2019):
Yes, @guillep2k it is.
@tanrui8765 commented on GitHub (Nov 11, 2019):
I am having this problem as well with Gitea 1.9.5.
Engineer 'A' started a pull request;
I commented on a line of code with 'Start review';
The next comment I was trying to add, triggered a 500 error.
Our code comments and pull request comments contains Chinese characters, the encoding is GBK.
@lunny commented on GitHub (Nov 11, 2019):
@tanrui8765 which database are you using? If it's mysql, which character set did you use?
@guillep2k commented on GitHub (Nov 11, 2019):
In my case it's postgresql 9.2.24.
@tanrui8765 commented on GitHub (Nov 11, 2019):
hello @lunny @guillep2k , I am using MySQL , character set is utf8.
@tanrui8765 commented on GitHub (Nov 11, 2019):
MySQL version is 5.7.26, gitea database character set is utf8_general_ci.
@lunny commented on GitHub (Nov 11, 2019):
Could you try use utf8mb4? You could change
app.ini[database]charset=utf8mb4. And you should also convert your database to utf8mb4.@tanrui8765 commented on GitHub (Nov 12, 2019):
Sure, I'll give it a try, but I am concerning that, will it cause some new problems like data miss or disordered or something?
@zeripath commented on GitHub (Nov 12, 2019):
Changing the database will not solve this.
The problem is we assume that code lines are in utf8 so just store the line of code as a string in the database.
Git makes no such guarantees and code lines can be in any encoding.
We either:
There are plenty of other places where we make the same wrong assumption: at the plumbing level git just stores bytes not strings.
All of these are potential failures with encoding - we don't see them very often because most people just use the default but it's a significant issue for anyone with old code. Unfortunately our code is full of assumptions regarding the string nature of all of these things.
So changing your MySQL table format ain't gonna fix this. Your codeline ain't value utf8 and although go hasn't complained the db certainly will.
@lunny commented on GitHub (Nov 12, 2019):
We could convert the code lines to utf8 before we save it to database.
@guillep2k commented on GitHub (Nov 12, 2019):
If we do this, we'd need to use the whole file for encoding detection, not just one line, as it's not enough context. The detection library requires at least 1024 bytes; the more, the better.
@tanrui8765 commented on GitHub (Nov 13, 2019):
BTW, I did a test today with just 'Add single comment' on lines of code. I can add many comments (added 6 comments) with no 500 error.
It seems like the problem only follows the 'Start review' ?
@guillep2k commented on GitHub (Nov 13, 2019):
That's correct. The multi-step review is the one failing.
@guillep2k commented on GitHub (Nov 14, 2019):
File encoding is something we should be very careful about if we ever implement a "suggest changes" feature like GitHub's. We could easily corrupt the file contents.
@davidsvantesson commented on GitHub (Aug 20, 2020):
I also get this fault (gitea 1.11.6). But I think that is a different fault than the original issue? That doesn't seem to have anything to do with encoding.
@zeripath commented on GitHub (Aug 21, 2020):
I've fixed the encoding problem. I've also fixed the invalidation problem - I thought that made it back to 1.11 but certainly in 1.12. I've just fixed another issue that was causing NPEs in a template file in 1.12 and master.
I think whatever was the original bug that caused this issue should now be fixed and therefore I'm gonna close this issue.
@davidsvantesson are you able to reproduce your problem on try or on the release v1.12 branch? If you can could you open another issue?