Skip to content

Re-attempt to delete temporary upload if the file is locked by another process#12447

Merged
zeripath merged 14 commits into
go-gitea:masterfrom
zeripath:fix-12339-file-locked
Aug 11, 2020
Merged

Re-attempt to delete temporary upload if the file is locked by another process#12447
zeripath merged 14 commits into
go-gitea:masterfrom
zeripath:fix-12339-file-locked

Conversation

@zeripath
Copy link
Copy Markdown
Contributor

@zeripath zeripath commented Aug 6, 2020

Fix #12339

Signed-off-by: Andrew Thornton art27@cantab.net

Fix go-gitea#12339

Signed-off-by: Andrew Thornton <art27@cantab.net>
@zeripath zeripath added this to the 1.13.0 milestone Aug 6, 2020
@zeripath zeripath changed the title Re-attempt to delete temporary upload if the process is locked Re-attempt to delete temporary upload if the file is locked by another process Aug 6, 2020
Comment thread models/upload.go Outdated
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Aug 6, 2020
@silverwind
Copy link
Copy Markdown
Member

File deletion on Windows can be a pain with the locking. I wonder if there are any third-party golang modules similar to https://github.com/isaacs/rimraf/blob/master/rimraf.js that deal with the various error scenarios.

@zeripath
Copy link
Copy Markdown
Contributor Author

zeripath commented Aug 8, 2020

Fine. Let's do this properly - replace all uses of os.Remove / os.RemoveAll with util.Remove / util.RemoveAll which will reattempt on certain errors.

Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
@zeripath zeripath mentioned this pull request Aug 9, 2020
6 tasks
Comment thread modules/util/remove.go Outdated
Comment thread modules/util/remove.go Outdated
Comment thread models/upload.go Outdated
Co-authored-by: silverwind <me@silverwind.io>
Comment thread models/upload.go Outdated
Comment thread models/unit_tests.go Outdated
Comment thread go.sum
Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Aug 11, 2020
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Aug 11, 2020
Signed-off-by: Andrew Thornton <art27@cantab.net>
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Aug 11, 2020

Codecov Report

Merging #12447 into master will decrease coverage by 0.00%.
The diff coverage is 32.14%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #12447      +/-   ##
==========================================
- Coverage   43.80%   43.79%   -0.01%     
==========================================
  Files         630      631       +1     
  Lines       69821    69851      +30     
==========================================
+ Hits        30585    30594       +9     
- Misses      34300    34311      +11     
- Partials     4936     4946      +10     
Impacted Files Coverage Δ
cmd/doctor.go 0.00% <0.00%> (ø)
cmd/dump.go 1.04% <0.00%> (-0.02%) ⬇️
models/admin.go 80.85% <0.00%> (ø)
models/attachment.go 57.74% <0.00%> (-1.41%) ⬇️
models/migrations/v112.go 0.00% <0.00%> (ø)
models/migrations/v115.go 0.00% <0.00%> (ø)
models/migrations/v96.go 0.00% <0.00%> (ø)
models/org.go 73.61% <0.00%> (ø)
models/repo.go 55.56% <0.00%> (ø)
models/upload.go 0.00% <0.00%> (ø)
... and 40 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update faa676c...47b9414. Read the comment docs.

@zeripath zeripath merged commit 74bd969 into go-gitea:master Aug 11, 2020
@zeripath zeripath deleted the fix-12339-file-locked branch August 11, 2020 20:05
@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

lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error when uploading images

5 participants