[heft] Windows support regression
Summary
After upgrading Heft, rush build on Windows started failing with an IO error (couldn't repro with rushx build) happening with random projects, e.g. not consistently the same packages, which seems to indicate that it is a race condition. However it does always happen with /temp/build.
Repro steps
We upgraded Heft and related plugins:
- "@rushstack/heft": "^0.68.2",
+ "@rushstack/heft": "0.74.5",
Expected result:
rush build still works on all machines
Actual result:
rush build fails on Windows with an IO error
Details
Rig changes:
Build error:
A few projects fail to build with this error:
--[ FAILURE: @wbd/beam-dom-extensions (build) ]--------------[ 2.17 seconds ]--
...
[build:clean] Starting clean
[build:clean] Deleted folder "C:/Users/name/monorepo-root/libraries/beam-dom-extensions/dist".
[build:clean] Deleted folder "C:/Users/name/monorepo-root/libraries/beam-dom-extensions/temp/build".
EPERM: operation not permitted, rmdir 'C:\name\monorepo-root\libraries\beam-dom-extensions\temp\build'
Standard questions
Please answer these questions to help us investigate your issue more quickly:
| Question | Answer |
|---|---|
@rushstack/heft version? |
0.74.5 |
| Operating system? | Windows |
| Would you consider contributing a PR? | Yes (with solid pointers) |
Node.js version (node -v)? |
20.18.1 |
If you run rush --debug build do you get a stack from that? Since you mention rushx build is working fine that suggests this is in the deletion layer prior to restoring build cache entries.
I ran it with --verbose as --debug didn't seem valid.
Edited the description: error is random and logs don't tell much.
Could it be that the clean task isn't able to finish the clean before the build step gets a hold of the /temp/build folder?
@philippe-wm - That's unlikely. All async filesystem operations should be settled before Heft moves on to a later phases.
Is it possible that something like Windows Defender has a lock on files in your repo?
@iclanton we see that both in CI (I doubt it runs Defender) and with a Windows Laptop. Also we don't see the issue with the older Heft version.
Disabling parallelism doesn't solve the issue.