On Windows, one cannot move a directory if it has files opened inside. A similar case occurs with ZFS. Ensure that all Build_log file descriptors are closed before promoting the temporary build directory and the log file it contains as definitive build result.
We can either ensure that all tail'ers have finished reading before closing the log file and moving the directory, or pause the tail'ers and resume reading from the moved log file.
I'm still struggling on it, it's not easy, I think I always end up in some sort of deadlock where the tail'ers and the Db_store layer are waiting on each other reciprocally.
I added a test for a very simple spec file that fails on ZFS (so I presume windows too iiuc) with the expected failure and the spec file -- now I'll look through the code to see why it's not working :))
On Windows, one cannot move a directory if it has files opened inside. A similar case occurs with ZFS. Ensure that all
Build_log
file descriptors are closed before promoting the temporary build directory and the log file it contains as definitive build result. We can either ensure that all tail'ers have finished reading before closing the log file and moving the directory, or pause the tail'ers and resume reading from the moved log file.I'm still struggling on it, it's not easy, I think I always end up in some sort of deadlock where the tail'ers and the
Db_store
layer are waiting on each other reciprocally.Originally posted by @patricoferris in https://github.com/ocurrent/obuilder/issues/98#issuecomment-1007474573
A workaround this issue is to let the store select the location of the log file and never move it, which I have implemented for the Windows backend.