Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal Server Error 500: GetBranchCommit: packfile not found #8330

Closed
2 of 7 tasks
robertschulze opened this issue Oct 1, 2019 · 7 comments
Closed
2 of 7 tasks
Labels
status/blocked This PR cannot be merged yet, i.e. because it depends on another unmerged PR type/bug

Comments

@robertschulze
Copy link

  • Gitea version (or commit ref): 4.0 (1.10.0+dev-334-gc6fb7fe27)
  • Git version: 2.23.0.windows.1 (portable)
  • Operating system: Windows 7
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Description

When trying to open one of my repos in the Gitea web interface, I receive an Internal Server Error 500. Checking the log file, I see:

.../xorm/session_raw.go:76:queryRows() [I] [SQL] SELECT `id`, `uid`, `repo_id` FROM `star` WHERE `uid`=? AND `repo_id`=? LIMIT 1 []interface {}{1, 2} - took: 0s
...ules/context/repo.go:606:func1() [E] GetBranchCommit: packfile not found

(I removed the timestamp)

Screenshots

info

@robertschulze
Copy link
Author

Can I provide anything else to help in/advance the analysis of the error?

@pampersrocker
Copy link

I've had just the same error.
git fsck and git fsck --full on the repository stored in gitea did not report anything broken and the error persists after a git repack.
The error message seems to come from go-git: https://github.com/src-d/go-git/blob/eb243ba9a55ac029ab3f9b15157920c46e24078b/storage/filesystem/dotgit/dotgit.go#L268

Pushing another commit to the default branch on my repository opens the repository again, but looking at the commit history does produce a 500 error due to

...uters/repo/commit.go:62:Commits() [E] CommitsByRange: packfile not found

For me this looks to be a bug in go-git not handling some case in a commit properly (as git itself does not report any errors)

@smile34
Copy link

smile34 commented Oct 4, 2019

we have the same problem with one of our repositories - when clicking on the repository in the web interface we get error 500

Log entry:
.../xorm/session_get.go:99:nocacheGet() [I] [SQL] SELECT id, uid, repo_id FROM star WHERE uid=? AND repo_id=? LIMIT 1 []interface {}{1, 5}
...ules/context/repo.go:605:func1() [E] GetBranchCommit: packfile not found

using:
Gitea Version: 1.9.3 built with GNU Make 4.1, go1.12.9 : bindata, sqlite, sqlite_unlock_notify
Git Version: 2.16.2
Database: sqlite3
Operating System: Windows Server 2016 Datacenter

@lunny
Copy link
Member

lunny commented Oct 5, 2019

@pampersrocker could you send an issue to https://github.com/src-d/go-git

@lunny lunny added type/bug status/blocked This PR cannot be merged yet, i.e. because it depends on another unmerged PR labels Oct 5, 2019
@pampersrocker
Copy link

pampersrocker commented Oct 6, 2019

If you look at the issues in src-d/go-git ( src-d/go-git#1223 , src-d/go-git#1149 , src-d/go-git#1153 ) this is caused when a git gc run is not completed successfully and .tmp files reside in the .git/objects/packs directory.

A workaround for now is to manually run git gc in the affected repositories and let it complete. This fixed it on my end.
The actual fix for this issue seems to be already discussed in the mentioned src-d/go-git issues.

@smile34
Copy link

smile34 commented Oct 7, 2019

manually triggered garbage collection via gitea site administration page and the issue is fixed. Thank you!

@robertschulze
Copy link
Author

Manually running git gc did the trick for me.
Thanks!

@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status/blocked This PR cannot be merged yet, i.e. because it depends on another unmerged PR type/bug
Projects
None yet
Development

No branches or pull requests

4 participants