Pull Request creation timouts and returns 500 code in 1.17.2

We have a massive repo in terms of number of files, which gitea usually handles fine. Upon upgrading to 1.17.2 we started to notice a problem with pull requests. Even a single character, single commit pull request creation (clicking “create pull request”) hangs for a long time and then returns 500. This issue occurs randomly and some pull requests are fine.

Upon checking gitea logs I can see error:

2022/09/07 09:19:25 ...ll/patch_unmerged.go:165:unmergedFiles() [E] [631842bf-15] Unable to run ls-files -u -z! Error: git ls-files -u -z: context deadline exceeded
2022/09/07 09:19:28 ...ers/web/repo/pull.go:1244:CompareAndPullRequestPost() [E] NewPullRequest: unable to run ls-files -u -z! Error: git ls-files -u -z: context deadline exceeded

So far I did garbage collection but problem did not disappear. In fact I had to do garbage collection from backend since from gitea front I was getting as well:

2022/09/07 09:53:37 models/db/context.go:140:Insert() [I] [63184d5e-3] [SQL] INSERT INTO notice (type,description,created_unix) VALUES (?,?,?) [1 Repository garbage collection failed for /mnt/disk1/git/gitea-repositories/telia/salesforce.git. Stdout: 
    Error: context deadline exceeded 1662537217] - 17.470209ms
2022/09/07 09:53:37 ...dels/admin/notice.go:55:CreateNotice() [I] [63184d5e-3] [SQL] INSERT INTO notice (type,description,created_unix) VALUES (?,?,?) [2 Task: Garbage collect all repositories cancelled: Repository garbage collection failed in repo: Telia/Salesforce: Error: <nil> 1662537217] - 1.922105ms

Hello, Did you manage to resolve this issue? i have the same issue after migrating to 1.17.2. creating PR for “develop” branch always timeout with 500. i tried to increase the timeout setting but its not working. its like its just shows the loading icon and do nothing. I’ve got the same error in logs too.