openFile gives "file is locked" error on Linux when creating a non-existing file
Viktor Dukhovni
ietf-dane at dukhovni.org
Wed Oct 9 05:01:47 UTC 2024
On Wed, Oct 09, 2024 at 10:24:30AM +0530, Harendra Kumar wrote:
> I just noticed that cabal seems to be running test suites in parallel.
> We have two test suites. Even though each test suite generates the
> temp names randomly, they use the same prefix, if the generated names
> have a possibility of conflict due to PRNG it may cause a problem.
> That is perhaps the more likely cause rather than hunting this in GHC.
> cabal running tests in parallel without explicitly saying so came as a
> surprise to me. In fact I found an issue in cabal repo asking for a
> "feature" to run them sequentially, the issue is still open -
> https://github.com/haskell/cabal/issues/6751 . Hopefully this is it.
Just parallel execution is not sufficient to explain the observed
problem, you still need to have the same inode/dev already open
in the same process, or bookkeeping of which dev/ino pairs are
in use to be incorrect.
So either the Github filesystem is reusing inodes of already deleted,
but still open files (a deviation from expected Unix behaviour), or
somehow GHC fails to correctly track the dev/ino pairs of open handles.
My best guess is that something is manipulating file descriptors
directly, bypassing the Handle layer, and *then* parallel execution
could exacerbate the resulting inconsistent state.
--
Viktor.
More information about the ghc-devs
mailing list