Details
-
Bug
-
Resolution: Won't Fix
-
High
-
None
-
6.4.0, 6.10.5, 7.5.2
-
2
-
Severity 2 - Major
-
0
-
Description
Issue Summary
Git creates loose objects and pack files on Windows with the read-only flag set. As Bitbucket Server has migrated from Java's File API (which clears the read-only flag in delete()) to Path, many different codepaths can now fail to delete files. The majority of these File to Path changes shipped in Bitbucket Server 6.4.0.
These failures typically do not cause the overall operation to fail. Instead, the most common side effect is that the failure leaves temporary files behind that should have been cleaned up. These can eventually accumulate to a point where they take a considerable amount of disk space, and will only ever be removed if done so manually by an admin.
Steps to Reproduce
Some examples of codepaths affected (or potentially affected) by this issue:
- Deleting a repository
- This is probably the most severe case, as it doesn't "just" leak temporary files; instead, it can leave "deleted" repository contents on disk forever
- Editing files via the browser
- Merging a pull request
- Rebasing a pull request
Expected Results
- Operations that produce temporary files should correctly clean up after themselves without requiring administrator intervention
- Repositories should be deleted from disk when they're removed from the system
Actual Results
In some cases, files may be "leaked".
- For repository deletion, this will produce errors in the logs with messages like "The following repository directory could not be deleted"
- For temporary files, generally there is no logging to indicate deletion was unsuccessful; the failure is silently ignored
Workaround
Manually delete files from disk. The most common location for such files is %BITBUCKET_HOME%\tmp.