Error 500 when viewing a commit by its ID #10585

Closed
opened 2025-11-02 09:12:00 -06:00 by GiteaMirror · 5 comments
Owner

Originally created by @a20eac1d on GitHub (Apr 2, 2023).

Description

When trying to view commits by their ID, Gitea sometimes crashes and shows an "Error 500" page.

I can make this issue appear very reliably when I have multiple requests open at the same time (click on multiple commit IDs in short time) or if I abort the current page load and then reload it immediately. It seems like the previous request is still going on the server and the new request is messing it up.

The error:

An error occurred:

template: repo/diff/section_unified:32:28: executing "repo/diff/section_unified" at <$section.GetComputedInlineDiffFor>: error calling GetComputedInlineDiffFor: runtime error: slice bounds out of range [2:1]

Gitea Version: 1.19.0

Gitea Version

1.19.0

Can you reproduce the bug on the Gitea demo site?

YES! See comment below

Log Gist

Updated Gist with more info:

https://gist.github.com/a20eac1d/4f2037bdfe147d2ad8c7ea375724f72a

Screenshots

https://i.imgur.com/BDd2x90.png

Git Version

2.38.4, Wire Protocol Version 2 Enabled

Operating System

Ubuntu 22.04 LTS

How are you running Gitea?

Gitea is running in a Docker container, created with the official tutorial at: https://docs.gitea.io/en-us/install-with-docker/

Database

SQLite

Originally created by @a20eac1d on GitHub (Apr 2, 2023). ### Description When trying to view commits by their ID, Gitea sometimes crashes and shows an "Error 500" page. I can make this issue appear very reliably when I have multiple requests open at the same time (click on multiple commit IDs in short time) or if I abort the current page load and then reload it immediately. It seems like the previous request is still going on the server and the new request is messing it up. The error: ``` An error occurred: template: repo/diff/section_unified:32:28: executing "repo/diff/section_unified" at <$section.GetComputedInlineDiffFor>: error calling GetComputedInlineDiffFor: runtime error: slice bounds out of range [2:1] Gitea Version: 1.19.0 ``` ### Gitea Version 1.19.0 ### Can you reproduce the bug on the Gitea demo site? YES! See comment below ### Log Gist Updated Gist with more info: https://gist.github.com/a20eac1d/4f2037bdfe147d2ad8c7ea375724f72a ### Screenshots https://i.imgur.com/BDd2x90.png ### Git Version 2.38.4, Wire Protocol Version 2 Enabled ### Operating System Ubuntu 22.04 LTS ### How are you running Gitea? Gitea is running in a Docker container, created with the official tutorial at: https://docs.gitea.io/en-us/install-with-docker/ ### Database SQLite
GiteaMirror added the type/bug label 2025-11-02 09:12:00 -06:00
Author
Owner

@lunny commented on GitHub (Apr 2, 2023):

Is your patch a public one? Could you upload it to help the investigation?

@lunny commented on GitHub (Apr 2, 2023): Is your patch a public one? Could you upload it to help the investigation?
Author
Owner

@a20eac1d commented on GitHub (Apr 2, 2023):

@lunny Sorry, what do you mean by patch?

@a20eac1d commented on GitHub (Apr 2, 2023): @lunny Sorry, what do you mean by patch?
Author
Owner

@a20eac1d commented on GitHub (Apr 2, 2023):

This bug appears to be a regression. When I downgrade my Gitea instance back to 1.18.0 (with the exact same settings) I cannot reproduce this issue. Upgrading to 1.19.0 again causes it to happen.

@a20eac1d commented on GitHub (Apr 2, 2023): This bug appears to be a regression. When I downgrade my Gitea instance back to 1.18.0 (with the exact same settings) I cannot reproduce this issue. Upgrading to 1.19.0 again causes it to happen.
Author
Owner

@a20eac1d commented on GitHub (Apr 2, 2023):

@lunny

I was able to re-produce this issue on the official Gitea demo site. It is much more difficult to make it happen on there and it is super easy for me to reproduce on my local instance, so I believe the available CPU power has something to do with it.

Check out this repository: https://try.gitea.io/a20eac1d/bug1190/commits/branch/main

Under the SHA1 header you can find a button that says "f8269d2a24". Pressing this will take you to that specific commit. You need to press that button with your middle mouse button 5-15 times so that you have many tabs open trying to load that commit at the same time. If you are lucky, at some point at least one of those tabs will crash with an "Error 500". This happens rarely on a powerful instance like the Gitea demo, but it happens extremely often on my local instance which has less CPU power available. This does not happen on 1.18.0 and it only started happening in 1.19.0

@a20eac1d commented on GitHub (Apr 2, 2023): @lunny I was able to re-produce this issue on the official Gitea demo site. It is much more difficult to make it happen on there and it is super easy for me to reproduce on my local instance, so I believe the available CPU power has something to do with it. Check out this repository: https://try.gitea.io/a20eac1d/bug1190/commits/branch/main Under the SHA1 header you can find a button that says "f8269d2a24". Pressing this will take you to that specific commit. You need to press that button with your middle mouse button 5-15 times so that you have many tabs open trying to load that commit at the same time. If you are lucky, at some point at least one of those tabs will crash with an "Error 500". This happens rarely on a powerful instance like the Gitea demo, but it happens extremely often on my local instance which has less CPU power available. This does not happen on 1.18.0 and it only started happening in 1.19.0
Author
Owner

@wxiaoguang commented on GitHub (Apr 3, 2023):

Thank you for your detailed report! It helps a lot.

I think it could be fixed by Fix cases.Title crash for concurrency #23885

#21814 was introduced by 1.19, it makes the compare page crashes more than before.

@wxiaoguang commented on GitHub (Apr 3, 2023): Thank you for your detailed report! It helps a lot. I think it could be fixed by Fix cases.Title crash for concurrency #23885 #21814 was introduced by 1.19, it makes the compare page crashes more than before.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#10585