-
Notifications
You must be signed in to change notification settings - Fork 519
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
Unable to use http cluster with bazel #227
Comments
@alexeagle I've put a $ diff -Naur bazel-bin/server/http_bin_loader.js{.bak,}
--- bazel-bin/server/http_bin_loader.js.bak 2018-06-13 14:46:44.701734959 -0700
+++ bazel-bin/server/http_bin_loader.js 2018-06-13 14:46:42.531734975 -0700
@@ -220,6 +220,7 @@
var originalResolveFilename = module.constructor._resolveFilename;
module.constructor._resolveFilename =
function(request, parent) {
+ console.log(`module.constructor._resolveFilename(${JSON.stringify(request)})`);
var failedResolutions = [];
var resolveLocations = [
request,
$ bazel-bin/server/http
module.constructor._resolveFilename("source-map-support")
WARNING: source-map-support module not installed.
Stack traces from languages like TypeScript will point to generated .js files.
module.constructor._resolveFilename("com_github_kalbasit_bazel/server/http.js")
module.constructor._resolveFilename("com_github_kalbasit_bazel/server/cluster")
module.constructor._resolveFilename("cluster")
module.constructor._resolveFilename("os")
module.constructor._resolveFilename("com_github_kalbasit_bazel/server/server")
module.constructor._resolveFilename("com_github_kalbasit_bazel/server/lib")
[server-1528926301026] Starting master
[server-1528926301026] listening on :8080
[server-1528926301026] Cluster options: {
"count": 8,
"name": "server-1528926301026"
}
[server-1528926301026] starting worker thread
[server-1528926301026] starting worker thread
[server-1528926301026] starting worker thread
[server-1528926301026] starting worker thread
[server-1528926301026] starting worker thread
[server-1528926301026] starting worker thread
[server-1528926301026] starting worker thread
[server-1528926301026] starting worker thread
module.js:549
throw err;
^
Error: Cannot find module '/home/kalbasit/code/personal/base/src/github.com/kalbasit/bazel-reproducible/http-cluster-does-not-work/com_github_kalbasit_bazel/server/http.js'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Function.Module.runMain (module.js:693:10)
at startup (bootstrap_node.js:188:16)
at bootstrap_node.js:609:3
module.js:549
throw err;
^ @alexeagle any pointers on how to fix this? |
@gregmagolan worked recently on how node programs under Bazel find the same node binary when calling out to another node process. This seems slightly different since it's failing in module resolution after forking another process. |
This will be solved when |
We currently have an HTTP server build using nodejs cluster. When we call
fork
it blows up because it's looking for the binary at the wrong place.It's trying to find the module at
/home/kalbasit/.cache/bazel/_bazel_kalbasit/727d60ccb89e565dc5ed6e14ea3a46c6/execroot/com_github_kalbasit_bazel/bazel-out/k8-fastbuild/bin/server/http.runfiles/com_github_kalbasit_bazel/com_github_kalbasit_bazel/server/http.js
But the module actually lives at
/home/kalbasit/.cache/bazel/_bazel_kalbasit/727d60ccb89e565dc5ed6e14ea3a46c6/execroot/com_github_kalbasit_bazel/bazel-out/k8-fastbuild/bin/server/http.runfiles/com_github_kalbasit_bazel/server/http.js
Notice the double
com_github_kalbasit_bazel
(that's the workspace name).I've put together a reproducible example here.
@alexeagle are you able to reproduce? Is this a BUG in
rules_nodejs
or in my code?The text was updated successfully, but these errors were encountered: