-
-
Notifications
You must be signed in to change notification settings - Fork 384
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PathRef for directories is filesystem-dependent and not reproducible #1808
Comments
I think, there is no Java API available, which is able to return a sorted recursive directory stream. So, we need to fall back to some self implemented directory traversal which may be less performant and may need more memory. Maybe, it could be hidden behind some settings (env variable?) or detected based on the filesystem type and/or OS? As this affects Mill cache correctness and reproducibility, we definitely will accept a PR. |
Hmm... could this return different hashes in the same run if the file got pulled in two different ways? (Diamond dependency) If so, that might explain the multi-hash thing that I was experiencing here |
@Sailsman63 I doubt that, as the mill dependency graph is a DAG (https://en.wikipedia.org/wiki/Directed_acyclic_graph) which is calculated once at the start of a Mill evaluation. So targets won't run more than one time. The hashCode of |
I changed my CI to Ext4 to mitigate this problem ande now I am not in trouble. |
The hashCode of PathRef returns a value that depends on the file listing order of the file system.
mill/main/api/src/mill/api/PathRef.scala
Lines 38 to 52 in 7d9eeac
os.walk
uses DirectoryStream, which returns a list of files in an indefinite order depending on the file system.As a concrete example, if an out directory is copied across machines in a Linux+XFS environment, the cache will be invalidated because the order in which files are stored changes. Note that ext4 hides this problem because it returns a stable file list.
I think mill should compute hashCode by sorting instead of filesystem-dependent order.
File listing order in XFS
File listing order in EXT4
The text was updated successfully, but these errors were encountered: