-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Failed to update size for repository by a race condition #22386
Labels
Comments
Take a look at the lock file comment. https://github.com/git/git/blob/2a97289ad8b103625d3a1a12f66c27f50df822ce/lockfile.h#L9-L16 |
zeripath
pushed a commit
that referenced
this issue
Jan 13, 2023
Fix #22386 `GetDirectorySize` moved as `getDirectorySize` because it becomes a special function which should not be put in `util`. Co-authored-by: Jason Song <i@wolfogre.com>
zeripath
pushed a commit
to zeripath/gitea
that referenced
this issue
Jan 16, 2023
Backport go-gitea#22392 Fix go-gitea#22386 `GetDirectorySize` moved as `getDirectorySize` because it becomes a special function which should not be put in `util`. Co-authored-by: Jason Song <i@wolfogre.com>
jolheiser
pushed a commit
that referenced
this issue
Jan 16, 2023
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Description
There is a race condition regarding updating the repo size while processing pushes.
It is observed:
GetDirectorySize
regarding the existence of the path. If the path does not exist, a response of size 0 would be a good response so as not to cause an error. For example, this error 500 is thrown due to bad code in the caller.filepath.WalkFunc
could handle this case by checking theos.Lstat
error and thelock
suffix of the filename. For example this error handling is done by another very similar code with the suggested protection but even more general than excluding non-existing lock files.filepath.WalkDir
instead offilepath.Walk
because *Walk is less efficient than WalkDir, introduced in Go 1.16, which avoids callingos.Lstat
on every file or directory visited. The call uses a different walk function, but is very easy to adapt.Originally reported in https://codeberg.org/forgejo/forgejo/issues/216
Gitea Version
1.18.0
Can you reproduce the bug on the Gitea demo site?
No
Log Gist
No response
Screenshots
No response
Git Version
No response
Operating System
No response
How are you running Gitea?
systemd
Database
None
The text was updated successfully, but these errors were encountered: