-
Notifications
You must be signed in to change notification settings - Fork 524
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
fix(builtin): account for racy deletion of symlink in linker #2662
fix(builtin): account for racy deletion of symlink in linker #2662
Conversation
@devversion I hope this will address the linker failure we're seeing in angular/angular. |
af208a1
to
567d423
Compare
This would unfortunately not fix this class of failure. Maybe we should be lenient in the case |
567d423
to
2f85780
Compare
@JoostK yeah, this might improve the odds of having successful builds. I'm specifically speaking of "odds" here because I think conceptually Windows and Bazel w/ concurrency will never work out 100% here. The reason is that multiple actions/tests operate on the same |
I think one idea to solve the concurrency for windows would be to just link the |
On Windows, the linker has been prone to race conditions with respect to symlinking packages into the `node_modules` tree, causing ENOENT errors that causes the target to fail. Since the intention of `symlinkWithUnlink` and `deleteDirectory` is to unlink the directory anyway, we can simply ignore ENOENT errors for the directory that would be about to be unlinked.
2f85780
to
b1b0409
Compare
…ontrib#2662) On Windows, the linker has been prone to race conditions with respect to symlinking packages into the `node_modules` tree, causing ENOENT errors that causes the target to fail. Since the intention of `symlinkWithUnlink` and `deleteDirectory` is to unlink the directory anyway, we can simply ignore ENOENT errors for the directory that would be about to be unlinked.
On Windows, the linker has been prone to race conditions with respect to
symlinking packages into the
node_modules
tree, causing ENOENT errorsthat causes the target to fail. Since the intention of
symlinkWithUnlink
is to unlink the directory anyway, we can simply ignore ENOENT errors for
the directory that would be about to be unlinked.
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
We've been having quite a lot of Windows-only flakes where the linker fails with an ENOENT error.
And example can be found in this angular/angular job.
What is the new behavior?
The ENOENT error that occurs due to a race condition no longer causes the linker to fail.
Does this PR introduce a breaking change?
Other information
There might continue to be a window for race conditions, but this change should help address the observed failures. Looking at the call site:
https://github.com/bazelbuild/rules_nodejs/blob/768d352d2fea8ce76e1d0cb5f0bde86c5f73c222/internal/linker/link_node_modules.ts#L653-L664
it becomes clear that
isLeftoverDirectoryFromLinker
is executed between obtaining the stats and actually runningsymlinkWithUnlink
, and sinceisLeftoverDirectoryFromLinker
performs a directory walk it may provide ample opportunity for the stats to get stale.