[SERVER-57731] File/folder may be locked for delete on Windows Created: 15/Jun/21 Updated: 03/Sep/21 Resolved: 03/Sep/21 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Concurrency |
| Affects Version/s: | 5.1 Required |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Sergey Galtsev (Inactive) | Assignee: | Sergey Galtsev (Inactive) |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | neweng | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||
| Operating System: | ALL | ||||
| Sprint: | Security 2021-09-06 | ||||
| Participants: | |||||
| Linked BF Score: | 40 | ||||
| Description |
|
Windows may not allow for immediate file deletion thus causing an exception. An example of this is in BF-13075 and BFG-858391. Specific error is in src/mongo/shell/shell_utils_launcher.cpp in ResetDbpath, where Windows exceptions are handled by sleep followed by retry. This method reduces number of failures, but does not fully eliminate them Per https://docs.microsoft.com/en-us/windows/win32/fileio/closing-and-deleting-files , there is an alternative way of deleting an object: it has to be renamed and then a DeleteFile function invoked ("The DeleteFile function marks a file for deletion on close"). This would produce an empty directory, and the old one would be eventually gone Before starting work on this ticket, need to determine if this could be done using standard c++ or boost, whithout expressly invoking win32 functionality. |
| Comments |
| Comment by Sergey Galtsev (Inactive) [ 03/Sep/21 ] | ||||||||||||||
|
will not do it, since solution as-described doesn't work, and the problem is too rare to bother fixing | ||||||||||||||
| Comment by Sergey Galtsev (Inactive) [ 31/Aug/21 ] | ||||||||||||||
|
Following code fragment was used to override the locked directory condition on windows; I tested, but it didn't solve the problem:
|