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
43.38k stars 5.33k forks source link

Repeated 500 Errors in Gitea Logs #31595

Open amix307 opened 2 weeks ago

amix307 commented 2 weeks ago

Description

I have observed a recurring issue where multiple 500 Internal Server Error responses are being logged in Gitea. Below are some sample log entries indicating the problem:

router.log:513093:2024/07/09 11:38:42 ...eb/routing/logger.go:102:func1() [I] router: completed POST /api/internal/ssh/10/update/1559 for 127.0.0.1:0, 500 Internal Server Error in 13.3ms @ private/key.go:16(private.UpdatePublicKeyInRepo) router.log:513104:2024/07/09 11:38:42 ...eb/routing/logger.go:102:func1() [I] router: completed POST /api/internal/ssh/10/update/5689 for 127.0.0.1:0, 500 Internal Server Error in 4.9ms @ private/key.go:16(private.UpdatePublicKeyInRepo) router.log:513122:2024/07/09 11:38:42 ...eb/routing/logger.go:102:func1() [I] router: completed POST /api/internal/ssh/10/update/5749 for 127.0.0.1:0, 500 Internal Server Error in 4.2ms @ private/key.go:16(private.UpdatePublicKeyInRepo) router.log:513135:2024/07/09 11:38:42 ...eb/routing/logger.go:102:func1() [I] router: completed POST /api/internal/ssh/10/update/54 for 127.0.0.1:0, 500 Internal Server Error in 5.7ms @ private/key.go:16(private.UpdatePublicKeyInRepo) router.log:513257:2024/07/09 11:38:50 ...eb/routing/logger.go:102:func1() [I] router: completed POST /api/internal/ssh/10/update/2166 for 127.0.0.1:0, 500 Internal Server Error in 5.1ms @ private/key.go:16(private.UpdatePublicKeyInRepo) ... access.log:931321:127.0.0.1 - - [09/Jul/2024:11:49:32 +0300] "POST /api/internal/ssh/10/update/1597 HTTP/1.1" 500 27 "" "GiteaServer" access.log:931322:127.0.0.1 - - [09/Jul/2024:11:49:32 +0300] "POST /api/internal/ssh/10/update/5982 HTTP/1.1" 500 27 "" "GiteaServer" access.log:931339:127.0.0.1 - - [09/Jul/2024:11:49:32 +0300] "POST /api/internal/ssh/10/update/5972 HTTP/1.1" 500 27 "" "GiteaServer" access.log:931341:127.0.0.1 - - [09/Jul/2024:11:49:32 +0300] "POST /api/internal/ssh/10/update/1215 HTTP/1.1" 500 27 "" "GiteaServer" access.log:931372:127.0.0.1 - - [09/Jul/2024:11:49:33 +0300] "POST /api/internal/ssh/10/update/1936 HTTP/1.1" 500 27 "" "GiteaServer" access.log:931398:127.0.0.1 - - [09/Jul/2024:11:49:33 +0300] "POST /api/internal/ssh/10/update/63 HTTP/1.1" 500 27 "" "GiteaServer" access.log:931405:127.0.0.1 - - [09/Jul/2024:11:49:33 +0300] "POST /api/internal/ssh/10/update/4344 HTTP/1.1" 500 27 "" "GiteaServer" ...

How can I identifying the root cause of these repeated 500 errors? How can I trace and resolve this issue effectively? Thanx in advance

Gitea Version

1.22.1

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

2.31.1

Operating System

CentOS Stream 9

How are you running Gitea?

Self-hosted

Database

PostgreSQL

techknowlogick commented 2 weeks ago

Thanks for the report. Those logs are both just router logs, but if you can provide more verbose logs around the error we can start to debug.

amix307 commented 2 weeks ago

router.log gitea.log access.log @techknowlogick I collected logs at a certain point around one of the 500 events, hid the names of repositories and organizations I use haproxy for some reason for ssh access, so all ip is 127.0.0.1