go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
44.6k stars 5.45k forks source link

Error 500 when trying to open issue #4413

Closed arthur-bauer closed 6 years ago

arthur-bauer commented 6 years ago

Description

After updating macOs to the latest released version today, clicking on an existing issue or creating a new issue leads to a HTTP 500 error page. Interestingly, the log shows a 404 instead:

2018/07/10 19:12:29 [T] AppPath: /usr/local/bin/gitea
2018/07/10 19:12:29 [T] AppWorkPath: /usr/local/bin
2018/07/10 19:12:29 [T] Custom path: /usr/local/bin/custom
2018/07/10 19:12:29 [T] Log path: /usr/local/bin/log
2018/07/10 19:12:29 Serving [::]:3000 with pid 2434
[Macaron] 2018-07-10 19:12:31: Started GET / for 192.168.74.10
[Macaron] 2018-07-10 19:12:31: Started GET /api/v1/repos/search?uid=1&q=&limit=15&mode= for 192.168.74.10
[Macaron] 2018-07-10 19:12:31: Completed GET /api/v1/repos/search?uid=1&q=&limit=15&mode= 200 OK in 5.718733ms
[Macaron] 2018-07-10 19:12:31: Completed GET / 200 OK in 21.477864ms
[Macaron] 2018-07-10 19:12:34: Started GET /Private-projects/18-0631_Another_Test_Repo/issues/3 for 192.168.74.10
[Macaron] 2018-07-10 19:12:34: Completed GET /Private-projects/18-0631_Another_Test_Repo/issues/3 404 Not Found in 52.800474ms
[Macaron] 2018-07-10 19:12:38: Started GET /issues for 192.168.74.10
[Macaron] 2018-07-10 19:12:38: Completed GET /issues 200 OK in 11.66975ms
[Macaron] 2018-07-10 19:12:42: Started GET /Admin_GMSheet/issues/3 for 192.168.74.10
[Macaron] 2018-07-10 19:12:42: Completed GET /Admin_GMSheet/issues/3 404 Not Found in 113.60914ms
lafriks commented 6 years ago

Could be that paths or dir rights have changed in upgrade process?

arthur-bauer commented 6 years ago

Not sure about that. I can create new repos, milestones and even issues (I checked it in the sqlite db, the issues are created correctly). I can even add labels or close them in the issue overview. I just can't open/view the issue itself.

lafriks commented 6 years ago

There must be error in gitea.log or gitea stdout about internal server error

arthur-bauer commented 6 years ago

Here's the stdout, from starting gitea to clicking on the issue:

2018/07/13 10:47:47 [T] AppPath: /usr/local/bin/gitea
2018/07/13 10:47:47 [T] AppWorkPath: /usr/local/bin
2018/07/13 10:47:47 [T] Custom path: /usr/local/bin/custom
2018/07/13 10:47:47 [T] Log path: /usr/local/bin/log
2018/07/13 10:47:47 Serving [::]:3000 with pid 47310
[Macaron] 2018-07-13 10:47:50: Started GET /Admin/GMSheet/ for 192.168.74.10
[Macaron] 2018-07-13 10:47:50: Completed GET /Admin/GMSheet/ 200 OK in 198.326532ms
[Macaron] 2018-07-13 10:47:52: Started GET /Admin/GMSheet/issues for 192.168.74.10
[Macaron] 2018-07-13 10:47:52: Completed GET /Admin/GMSheet/issues 200 OK in 106.824118ms
[Macaron] 2018-07-13 10:47:54: Started GET /Admin/GMSheet/issues/4 for 192.168.74.10
[Macaron] 2018-07-13 10:47:55: Completed GET /Admin/GMSheet/issues/4 404 Not Found in 56.167319ms

And this is the output of the log:

2018/07/13 10:47:47 [I] Log Mode: File(Info)
2018/07/13 10:47:47 [I] XORM Log Mode: File(Info)
2018/07/13 10:47:47 [I] Cache Service Enabled
2018/07/13 10:47:47 [I] Session Service Enabled
2018/07/13 10:47:47 [I] Git Version: 2.18.0
2018/07/13 10:47:47 [I] SQLite3 Supported
2018/07/13 10:47:47 [I] Run Mode: Production
2018/07/13 10:47:47 [I] Listen: http://0.0.0.0:3000
2018/07/13 10:47:47 [I] LFS server enabled
2018/07/13 10:47:55 [...outers/repo/issue.go:636 ViewIssue()] [E] GetIssueByID: issue does not exist [id: 17, repo_id: 0, index: 0]
arthur-bauer commented 6 years ago

Anything else I could have a look at? The database doesn't contain an issue with the id 17 right now. The highest ID is 16.

lafriks commented 6 years ago

What issue id is with index 4?

arthur-bauer commented 6 years ago

There are two issues with index 4 (in two different repos). One has the id 10, the other the id 14.

sqlite> select "id","repo_id","index" from "issue" where "index"=4;
14|9|4
10|24|4
arthur-bauer commented 6 years ago

Ok... I think I'm on the right track now.

Recently, I deleted one or two test repos. There were entries in the repos' issue trackers. Now, these issues were deleted as well. And the time tracker was still running on one of these issues (the issue 17 above), although this wasn't the actual problem.

I now filled the deleted issue ids manually with some dump entries, and all issues can be opened again.

biju-ps commented 5 years ago

same here .. giteaError

On ubuntu 18.04 and sqlite ..

zeripath commented 5 years ago

Hi! Thanks for your report however it looks like you're using Gitea version 1.6.1 which is very old. I suggest you update to 1.7.4 which has just been released. I think this issue might already be solved.

However if you can replicate on 1.7.4 we will need some more information, in particular what the log files are showing and preferably a way to replicate the issue.