-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Managed directories has issue with node_modules/.bin folder on Windows #8491
Comments
/cc @irengrig @alexeagle |
Hi Greg, thank you for creating the issue. I experimented with rules_nodejs on Windows VM and currently I see the errors from "bazel test //..." - please see the output in the end of this comment. (there are more errors, I cut only the beginning for the second failing tests) My HEAD is at:
Output from "bazel test //...":
3 specs, 1 failure
|
Hi Greg, any updates on that? |
Hi Irina. Thanks for looking into this. Not super high priority as its not blocking anyone but would be interesting to find out the underlying cause. The web_package test is known to fail on Windows and you can filter it out with "fix-windows"
The other 2 look like build failures due to locally changes/generated files from previous builds but not 100% sure (this build is tested in Windows CI but rarely developed on with Windows). A clean checkout would answer that question. I'll try it out later on my Windows machine when I'm back home. |
Yes. The 2nd two failures only happen on Windows on 2nd run of that test. You can avoid it with a clean checkout. I'll fix that up as its annoying and rebase the https://github.com/gregmagolan/rules_nodejs/tree/user-node-modules-proto-windows-flake branch. I read the description again for this issue and I was actually not able to reproduce even once it locally on my Windows machine. It was only seen on buildkite CI https://buildkite.com/bazel/rules-nodejs-nodejs/builds/2487#26e54aca-4f4b-4626-89a4-f4d68953e53f but it did fail on buildkite consistently without the work-around. |
Update on my last comment. There is an error in that test that only happens on Windows as described but I took a look at the logs again in your comment and those failures are because bazel-contrib/rules_nodejs#848 is in progress which removes the pre-req and also fixes the Windows issue above. |
@irengrig bazel-contrib/rules_nodejs#848 which fixes the You'll want to filter out |
Thank you for the comments! I was able to reproduce the original problem on the Windows VM as well, but as there were other failures as well, I was not sure. |
Great! I cloned your repository & branch, and this is what I got on the second run (so the Bazel caches were alive): ERROR: C:/users/ichern/_bazel_ichern/yv2jimq7/external/fine_grained_deps_npm/BUILD.bazel:13:1: error loading package '@fine_grained_deps_npm//node_modules/.bin': Unexpected short read from file 'C:/users/ichern/_bazel_ichern/yv2jimq7/external/fine_grained_deps_npm/node_modules/.bin/BUILD.bazel' (expected 1499, got 1498 bytes) and referenced by '@fine_grained_deps_npm//:node_modules' The tests is not cached for the second invocation, because package-lock.json has changed by the first run, and it is one of the inputs. So somehow the FileValue of the generated BUILD.bazel file is cached before it is regenerated, and later the cached file size is expected to be read. |
Nice! Glad you could reproduce it. |
I guess I can can close this one, as rules_nodejs are no longer generate BUILD files under node_modules and in particular under node_modules/.bin directory. |
Description of the problem:
When running npm_install rule from rules_nodejs 0.30.0+, which relies on the new managed directories feature with Bazel 0.26.0, a truncated BUILD file read error (logs below) was observed on Windows in the
node_modules/.bin
folder. The error on buildkite: https://buildkite.com/bazel/rules-nodejs-nodejs/builds/2487#26e54aca-4f4b-4626-89a4-f4d68953e53fTruncated BUILD file reads were observed in the past under two conditions:
multiple yarn_install and/or npm_install rules using the same symlinked node_modules folder at the same time
when node_modules folder being used by yarn_install or npm_install was not added to workspace managed_directories attribute
I suspect the issue here is (2) since all instances of (1) were fixed when that error was first observed.
internal/e2e/fine_grained_deps/npm/node_modules/.bin/BUILD
My theory is that managed_directories is somehow skipping the .bin folder on Windows since folders starting with dot are considered hidden when doing a regular directory listing. I can't explain, however, why the error only shows up with npm_install and not yarn_install since they both layout the /node_modules/.bin folder. I suspect that it would happen for both rules and it's a race condition so it's just chance that it doesn't happen for the yarn_install. Locally I haven't been able to reproduce in either case.
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Originally seen during development of bazel-contrib/rules_nodejs#704
The branch to try to reproduce on a Windows machine is https://github.com/gregmagolan/rules_nodejs/tree/user-node-modules-proto-windows-flake
Failure can be seen in CI here https://buildkite.com/bazel/rules-nodejs-nodejs/builds/2548#6202a7dd-cb55-41a1-8c2b-277a60008826 from this repo PR bazel-contrib/rules_nodejs#772 which builds the
user-node-modules-proto-windows-flake
branch.Clone the above branch and run
bazel test ...
on a Windows machine.What operating system are you running Bazel on?
Windows (buildkite).
I was unable to reproduce locally on a Windows machine.
What's the output of
bazel info release
?Failure observed on buildkite with bazel: 0.26.0rc13 configured
Logs
The text was updated successfully, but these errors were encountered: