Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Data corruption on external volumes on Linux containers hosted on Windows #37284
When running a Linux Docker container using an external volume hosted on Windows, certain I/O patterns can result in losing your writes.
Full repro and code below.
If the sequence of events goes like this:
Read zeros from the file, as expected, since we didn't write to it yet.
Write to the actual location in the file, using
Try to read again, but you'll get cached data (all zeroes) instead of the just written data.
I've a reproduction that repeats this issue consistently, without the need of threading.
Steps to reproduce the issue:
Describe the results you received:
This is because we are reading the cached data.
Describe the results you expected:
I should be able to read the data I just wrote.
Additional information you deem important (e.g. issue happens only occasionally):
Reproduced this on multiple machines. I tried mounting the external volume with cache=strict and cache=none, didn't help.
This is in the context of hosting a database server on the container instance and being able to read the transaction journal for ACID purposes.
Note that this behavior seems to violate POSIX:
At least on the same file descriptor, not sure about different file descriptors.