Skip to content

Investigate aggressive methodCodeHashSignatures invalidation in com-lihaoyi/mill #4112

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

Closed
lihaoyi opened this issue Dec 11, 2024 · 2 comments
Milestone

Comments

@lihaoyi
Copy link
Member

lihaoyi commented Dec 11, 2024

The following diff seems to invalidate stuff throughout the codebase, rather than just in integration/ and example/ which is what I would expect. Worth looking into whether it's correct behaviour or not

lihaoyi mill$ git diff
diff --git a/integration/package.mill b/integration/package.mill
index 4268947e76..704070f88a 100644
--- a/integration/package.mill
+++ b/integration/package.mill
@@ -47,7 +47,7 @@ object `package` extends RootModule {
           Map(
             "MILL_INTEGRATION_SERVER_MODE" -> (mode == "local" || mode == "server").toString,
             "MILL_LAUNCHER" -> build.dist.bootstrapLauncher().path.toString,
-            "MILL_LAUNCHER_BAT" -> build.dist.bootstrapLauncherBat().path.toString,
+            "MILL_LAUNCHER_BAT2" -> build.dist.bootstrapLauncherBat().path.toString,
           ) ++
           testReleaseEnv()
@lihaoyi
Copy link
Member Author

lihaoyi commented Dec 12, 2024

Seems to be caused by non-deterministic classfile contents, maybe related to scala/scala3#22181.

Screenshot 2024-12-12 at 9 44 37 AM

@lihaoyi
Copy link
Member Author

lihaoyi commented Dec 12, 2024

Seems the module reference forwarders for sub-folder package.mill files are generated in non-determinstic orders

Screenshot 2024-12-12 at 9 47 11 AM

lihaoyi added a commit that referenced this issue Dec 12, 2024
…e aliases in the `build.mill`/`package.mill` file (#4113)

* The `Seq` returned from `MillBuildRootModule#scriptSources` comes from
the keys of a `Map`, meaning it is arbitrary non-deterministic orders
* Causing the resultant child module aliases (generated in `build.mill`
and `package.mill` files to reference sub-folder `package.mill` files)
to occur in non-deterministic orders
* Resulting in bytecode changes (e.g. varying the bit position of each
reference the lazy val initialization bitmap) that causes lots of stuff
to unnecessarily invalidate

Tested manually, seems to remove the misbehavior reported in
#4112. Managed to reproduce it
in `integration/invalidation/codesig-subfolder` with some tweaks, so I
left the repro in place to guard against regression

This still leaves us open to unnecessary invalidations if someone adds a
new `subfolder/package.mill` file in the middle of the list, but adding
new `package.mill`s is pretty uncommon so we can probably fix that in a
follow up
@lihaoyi lihaoyi closed this as completed Dec 12, 2024
@lefou lefou added this to the 0.12.4 milestone Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants