Bug ID 21723
Summary Setting a breakpoint on Windows leads to the target image file not being deletable for a short time even AFTER the process exits.
OS Windows NT
Component All Bugs
The python test suite uses LLDB as an in-process extension module. When running a test, it test suite first compiles the test program from source, and then debugs the resulting executable. When the test invokes LLDB's public API to set a breakpoint, this is implemented by an eventual call to WriteProcessMemory to write a breakpoint opcode into the target. After the test is complete, the test runner attempts to delete the compiled executable. For some reason, this call to WriteProcessMemory prevents the test runner from deleting the executable (error value is ERROR_ACCESS_DENIED). Commenting out this one system call -- and nothing else -- results in the executable being deletable by the test suite. This is incredibly strange behavior, and although I suspect a race condition between closing all the handles to the process and the test runner attempting to delete the process (perhaps a side effect of Bug 21722), there's no reasonable explanation why WriteProcessMemory would trigger the race. The fix may be as simple as fixing Bug 21722, but it also may be something different. And even if it is, it might be worth investigating this further and filing a bug against the Windows kernel.