-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
build: Don't regenerate node->out/*/node symlink if already there #9827
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with a request and a suggestion.
@@ -66,11 +66,11 @@ endif | |||
|
|||
$(NODE_EXE): config.gypi out/Makefile | |||
$(MAKE) -C out BUILDTYPE=Release V=$(V) | |||
ln -fs out/Release/$(NODE_EXE) $@ | |||
if [ ! -r $(NODE_EXE) ]; then ln -fs out/Release/$(NODE_EXE) $@; fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't -L (symbolic link) make more sense?
Can you add a comment here and below explaining why the check is necessary? It's going to look superfluous to the casual reader.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep I'll add a comment - that's a fair point.
Regarding -L, to be honest I wasn't certain it was standard sh syntax and also it would stop someone deliberately overriding it with an executable if they wanted to for any reason, although it appears to work on all the systems I've tried (AIX, Solaris, OS X, and of course linux) so I can add that in along with the -r (Since -L in itself will pass if it's a symlink that points to nothing which wouldn't be useful!)
The node -> out/*/node symlink is getting recreated in parallel with other targets in the makefile which require it (e.g. test-ci) and this seems to be causing a race condition which is showing up on AIX Ref: nodejs#9825
@bnoordhuis Done - have added both checks as per my comment on your review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, it'd be nice to have something that checks that the symlink points to out/Release/node
, but there doesn't seem to be a good POSIX way of doing it.
We could do, and while I'm not 100% against it I'm somewhat reluctant to use something that could limit portability (it doesn't work on a pure bourne shell). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@sxa555 Makes sense. In the future if not doing the check does cause issues for someone we can consider using something like |
Think this is ready to land. CI run here: https://ci.nodejs.org/job/node-test-pull-request/5206/ |
Only failure in CI is on ARM and it looks like the machine had a connection problem as opposed to any specific tests failing. Will land. |
Landed as f3d613e |
The node -> out/*/node symlink is getting recreated in parallel with other targets in the makefile which require it (e.g. test-ci) and this seems to be causing a race condition which is showing up on AIX Fixes: #9825 PR-URL: #9827 Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-by: Michael Dawson <michael_dawson@ca.ibm.com>
This needs to land together with #10153 wherever it lands |
Currently when running make node_g the following error is displayed: if [ ! -r node -o ! -L ]; then ln -fs out/Debug/node node_g; fi /bin/sh: line 0: [: argument expected It looks like there was a typo for the NODE_EXE where node became lowercase instead of uppercase. Ref: #9827 PR-URL: #10153 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Italo A. Casas <me@italoacasas.com>
The node -> out/*/node symlink is getting recreated in parallel with other targets in the makefile which require it (e.g. test-ci) and this seems to be causing a race condition which is showing up on AIX Fixes: #9825 PR-URL: #9827 Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-by: Michael Dawson <michael_dawson@ca.ibm.com>
Currently when running make node_g the following error is displayed: if [ ! -r node -o ! -L ]; then ln -fs out/Debug/node node_g; fi /bin/sh: line 0: [: argument expected It looks like there was a typo for the NODE_EXE where node became lowercase instead of uppercase. Ref: #9827 PR-URL: #10153 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Italo A. Casas <me@italoacasas.com>
The node -> out/*/node symlink is getting recreated in parallel with other targets in the makefile which require it (e.g. test-ci) and this seems to be causing a race condition which is showing up on AIX Fixes: nodejs#9825 PR-URL: nodejs#9827 Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-by: Michael Dawson <michael_dawson@ca.ibm.com>
The node -> out/*/node symlink is getting recreated in parallel with other targets in the makefile which require it (e.g. test-ci) and this seems to be causing a race condition which is showing up on AIX Fixes: #9825 PR-URL: #9827 Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-by: Michael Dawson <michael_dawson@ca.ibm.com>
Currently when running make node_g the following error is displayed: if [ ! -r node -o ! -L ]; then ln -fs out/Debug/node node_g; fi /bin/sh: line 0: [: argument expected It looks like there was a typo for the NODE_EXE where node became lowercase instead of uppercase. Ref: #9827 PR-URL: #10153 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Italo A. Casas <me@italoacasas.com>
The node -> out/*/node symlink is getting recreated in parallel with other targets in the makefile which require it (e.g. test-ci) and this seems to be causing a race condition which is showing up on AIX Fixes: #9825 PR-URL: #9827 Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-by: Michael Dawson <michael_dawson@ca.ibm.com>
Currently when running make node_g the following error is displayed: if [ ! -r node -o ! -L ]; then ln -fs out/Debug/node node_g; fi /bin/sh: line 0: [: argument expected It looks like there was a typo for the NODE_EXE where node became lowercase instead of uppercase. Ref: #9827 PR-URL: #10153 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Italo A. Casas <me@italoacasas.com>
The node -> out/*/node symlink is getting recreated in parallel with other targets in the makefile which require it (e.g. test-ci) and this seems to be causing a race condition which is showing up on AIX Fixes: #9825 PR-URL: #9827 Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-by: Michael Dawson <michael_dawson@ca.ibm.com>
Currently when running make node_g the following error is displayed: if [ ! -r node -o ! -L ]; then ln -fs out/Debug/node node_g; fi /bin/sh: line 0: [: argument expected It looks like there was a typo for the NODE_EXE where node became lowercase instead of uppercase. Ref: #9827 PR-URL: #10153 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Italo A. Casas <me@italoacasas.com>
The node -> out/*/node symlink is getting recreated in parallel with other targets in the makefile which require it (e.g. test-ci) and this seems to be causing a race condition which is showing up on AIX Fixes: #9825 PR-URL: #9827 Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-by: Michael Dawson <michael_dawson@ca.ibm.com>
Currently when running make node_g the following error is displayed: if [ ! -r node -o ! -L ]; then ln -fs out/Debug/node node_g; fi /bin/sh: line 0: [: argument expected It looks like there was a typo for the NODE_EXE where node became lowercase instead of uppercase. Ref: #9827 PR-URL: #10153 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Italo A. Casas <me@italoacasas.com>
Description of change
Checklist
make -j8 test
(UNIX), orvcbuild test nosign
(Windows) passesAffected core subsystem(s)
build
Description of change
Ref: #9825
This PR will stop the "ln -sf out/Release node node" (and it's Debug equivalent) from occurring if it is already in place. This appears to be causing a problem when it is executed in parallel with the node-gyp execution for the build-addons target as it appears to be triggering a race condition (visible in the AIX CI as per the referenced issue although I haven't replicated it on my own system) whereby the deletion of the symlink (A result of the -f) is leaving a small window before it is recreated where the addons build runs, which requires the node symlink to be in place. I can see no obvious reason why this would have ONLY showed up on the v4 release as the same condition can occur on master as far as I can tell.
The disadvantage of the solution in this PR is that if "node" already existed and wasn't previously a symlink to out/Release node then it won't overwrite it. I'm open to alternative suggestions on this - checking the output from "diff node out/Release/node" before replacing would work for example. Tagging @bnoordhuis as he has made some comments in Makefile around thisagainst the build-addons target in the makefile. The problem also goes away if the $(NODE_EXE) target is not listed as ".PHONY" but since that was done for sensible reasons I assume we need to leave that in place, and this is really just a "workaround" for the fact it's not a true dependency.