GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Revert "tools,gyp: don't force build actions with multiple outputs" by thefourtheye · Pull Request #23257 · nodejs/node

Conversation

@thefourtheye

@thefourtheye thefourtheye commented Oct 4, 2018

Copy link
Copy Markdown
Contributor

This reverts commit 5d8373a.

Fixes: #23255


cc @refack @devsnek @targos

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@nodejs-github-bot

nodejs-github-bot commented Oct 4, 2018

Copy link
Copy Markdown
Collaborator

@thefourtheye build started: https://ci.nodejs.org/blue/organizations/jenkins/node-test-pull-request-lite-pipeline/detail/node-test-pull-request-lite-pipeline/1122/pipeline

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot nodejs-github-bot added build Issues and PRs related to Node.js builds or CI infrastructure. tools Issues and PRs related to the tools directory. labels Oct 4, 2018
danbev
danbev approved these changes Oct 4, 2018
View reviewed changes
@danbev

danbev commented Oct 4, 2018

Copy link
Copy Markdown
Contributor

Could this be fast-tracked? If you think so please add a 👍

danbev, thefourtheye, cjihrig, refack, and addaleax reacted with thumbs up emoji
All reactions
  • 👍 5 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@thefourtheye

thefourtheye commented Oct 4, 2018

Copy link
Copy Markdown
Contributor Author

As per @danbev's comment #23255 (comment), make clean fixes this problem.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@thefourtheye thefourtheye closed this Oct 4, 2018
@thefourtheye
thefourtheye deleted the unblock-local-make branch October 4, 2018 08:35
@cjihrig cjihrig mentioned this pull request Oct 4, 2018
make with -j hangs #23255
Closed
@thefourtheye
thefourtheye restored the unblock-local-make branch October 4, 2018 13:39
@thefourtheye

thefourtheye commented Oct 4, 2018

Copy link
Copy Markdown
Contributor Author

Reopening as per #23255 (comment). Even my rebuild after make clean stopped responding.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@thefourtheye thefourtheye reopened this Oct 4, 2018
cjihrig
cjihrig approved these changes Oct 4, 2018
View reviewed changes
@thefourtheye
Revert "tools,gyp: don't force build actions with multiple outputs"
d16e20b
This reverts commit 5d8373a.

Fixes: nodejs#23255
@thefourtheye
thefourtheye force-pushed the unblock-local-make branch from 04f7565 to d16e20b Compare October 4, 2018 13:44
refack
refack approved these changes Oct 4, 2018
View reviewed changes
@refack

refack commented Oct 4, 2018

Copy link
Copy Markdown
Contributor

Well, back to the drawing board for me 🤷‍♂️

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@refack refack added the regression Issues related to regressions. label Oct 4, 2018
@refack

refack commented Oct 4, 2018

Copy link
Copy Markdown
Contributor

CI: https://ci.nodejs.org/job/node-test-pull-request/17630/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

addaleax
addaleax approved these changes Oct 4, 2018
View reviewed changes
@addaleax addaleax added the fast-track PRs proposed for a shorter-than-standard waiting period before landing. label Oct 4, 2018
@addaleax

addaleax commented Oct 4, 2018

Copy link
Copy Markdown
Member

Landed in 17a0cd2

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@addaleax addaleax closed this Oct 4, 2018
addaleax pushed a commit that referenced this pull request Oct 4, 2018
@thefourtheye @addaleax
Revert "tools,gyp: don't force build actions with multiple outputs"
17a0cd2
This reverts commit 5d8373a.

Fixes: #23255

PR-URL: #23257
Reviewed-By: Daniel Bevenius <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
@devsnek

devsnek commented Oct 5, 2018

Copy link
Copy Markdown
Member

This hasn't fixed the problem for me :(

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@danbev

danbev commented Oct 5, 2018

Copy link
Copy Markdown
Contributor

@devsnek Just wanted to ask if you have done another make clean. I ran into this once more yesterday after updating master (I'm not exactly sure but I think it was after 9800fd7). After doing a make clean I've not seen it again. This might just be a coincidence but my thinking was that perhaps one of the generated makefiles was stale in some way (missing dependency or something like) causing this and was the reason I did a clean again. I'm on mac by the way just incase that might matter.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

targos pushed a commit that referenced this pull request Oct 5, 2018
@thefourtheye @targos
Revert "tools,gyp: don't force build actions with multiple outputs"
a656268
This reverts commit 5d8373a.

Fixes: #23255

PR-URL: #23257
Reviewed-By: Daniel Bevenius <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
@refack refack mentioned this pull request Oct 5, 2018
deps,v8: link with atomic for platforms lacking CAS #23286
Closed
2 tasks done
@targos targos mentioned this pull request Oct 10, 2018
Release proposal: v10.12.0 #23313
Merged
@beevelop beevelop mentioned this pull request Oct 10, 2018
2018-10-10 Version 10.12.0 (Current) @targos beevelop/docker-nodejs#225
Closed
This was referenced Oct 10, 2018
2018-10-10 Version 10.12.0 (Current) @targos beevelop/docker-android-nodejs#239
Closed
2018-10-10 Version 10.12.0 (Current) @targos beevelop/docker-nodejs#226
Closed
2018-10-10 Version 10.12.0 (Current) @targos beevelop/docker-android-nodejs#240
Closed
2018-10-10 Version 10.12.0 (Current) @targos beevelop/docker-nodejs#227
Closed
2018-10-10 Version 10.12.0 (Current) @targos beevelop/docker-android-nodejs#241
Closed
2018-10-10 Version 10.12.0 (Current) @targos beevelop/docker-android-nodejs#242
Closed
2018-10-10 Version 10.12.0 (Current) @targos beevelop/docker-nodejs#228
Closed
2018-10-10 Version 10.12.0 (Current) @targos beevelop/docker-android-nodejs#243
Closed
2018-10-10 Version 10.12.0 (Current) @targos beevelop/docker-nodejs#229
Closed
@targos targos mentioned this pull request Oct 17, 2018
deps: update V8 to 7.1 #23423
Closed
jasnell pushed a commit that referenced this pull request Oct 17, 2018
@thefourtheye @jasnell
Revert "tools,gyp: don't force build actions with multiple outputs"
0e33493
This reverts commit 5d8373a.

Fixes: #23255

PR-URL: #23257
Reviewed-By: Daniel Bevenius <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
@targos targos mentioned this pull request Oct 24, 2018
build,meta: bump gcc on travis #23778
Merged
3 tasks done
@refack refack mentioned this pull request Oct 30, 2018
tools,gyp: don't force build actions with multiple outputs #23982
Closed
2 tasks done
LalitMaganti added a commit to LalitMaganti/gyp-next that referenced this pull request Nov 9, 2026
@LalitMaganti
fix(make): stop re-running multi-output actions on every build
42a5412
Actions with several outputs are written as a rule on intermediate files.
For do_cmd actions these files are lost between builds because .INTERMEDIATE
deletes them and the depfile is not read. This meant the recorded command
always looked changed.

Furthermore, the unconditional touch overwrote that command in the depfile
anyway.

Together, this meant that every make invocation re-ran the action and rebuilt
everything depending on its outputs.

In Node.js main (a43bfb5bb) no-op `make` re-ran these actions unconditionally
and then recompiled anything that depends on their outputs. Running `make`
on an up-to-date tree:

  | Machine                          | Jobs | Before    | After |
  |----------------------------------|------|-----------|-------|
  | 12-core Linux, no compiler cache | -j12 | 40-45 s   | 2.3 s |
  | 12-core Linux, no compiler cache | -j4  | 55-57 s   | 2.4 s |
  | 12-core Linux, no compiler cache | -j1  | 148-153 s | 2.2 s |

To be clear, this doesn't just affect local development but *also*
Node's CI: GitHub Actions test jobs run `make test-ci -j1` right after
`make build-ci`, so the Linux test jobs each spend 48-55 s re-making node,
even with sccache.

I found this with [buildprof](https://github.com/LalitMaganti/buildprof), a
build profiling tool I wrote. Here are the before/after traces demonstrating
this issue.

* [Before](https://buildprof.lalitm.com/v0.3.0/#!/?url=https://buildprof.lalitm.com/examples/node-noop-file-events-before.buildprof)
* [After](https://buildprof.lalitm.com/v0.3.0/#!/?url=https://buildprof.lalitm.com/examples/node-noop-file-events-after.buildprof)

This PR fixes the issue by keeping the intermediate as .SECONDARY, reading its depfile,
and touching it only when the command actually runs. It also deletes it at
parse time if any output is missing so deleted outputs are still regenerated.

## Native addons bonus

This isn't just about Node either: node-gyp uses the same make generator,
so native addons hit the same problem.

For example, with better-sqlite3, a no-op `node-gyp build -j12`:

  | node-gyp           | No-op build   |
  |--------------------|---------------|
  | 13.1.0             | 38.2-40.3 s   |
  | 13.1.0 + this fix  | 0.04-0.05 s   |

## Testing

* New integration tests check that up-to-date outputs are not regenerated,
  and that a changed input, a missing output and a changed command all still
  regenerate. Two of them fail without this change.
* In Node.js with this change applied to `tools/gyp`, rebuilds
  still happen when they should: deleting the generated headers re-runs the
  actions and recompiles their users, touching the generator inputs does the
  same, and deleting `node` only relinks it.
* The same for better-sqlite3: deleting the generated `sqlite3.c` or touching
  its input rebuilds it, and the next no-op does nothing again.
* GNU make 3.81, 4.1 and 4.4.1.

## Historical context

Node tried a related change in 2018 (nodejs/node#23156) and reverted it
two days later (nodejs/node#23257) because `make -j` hung
(nodejs/node#23255).

That was clearly a long time ago and a lot has changed since,
but to be safe I ran the Node build with GNU make 3.81 on macOS at -j2, -j4
and -j10. I tested no-op builds, deleting `node`, deleting generated outputs
and touching inputs.

I couldn't reproduce any hangs whether with this change or with the 2018 one:
https://github.com/LalitMaganti/bp/actions/runs/42411314457

This is also the cause of nodejs/node#25135 (`make node; make node`
relinks every time), which has been open since 2018. I believe that can be
closed once Node adopts this PR.

## AI disclosure

I used LLM coding agents to drive buildprof and collect traces. I then manually
inspected before traces, and then once the agent generated the patch, I also
verified after. The worst case for this patch is accidentally saying there is
nothing to do when something needs to be recompiled so I came up with all the
potential ideas I could and got the agent to stress test it; neither I nor the
agent managed to find any breaking case.

Assisted-By: LLM
@LalitMaganti LalitMaganti mentioned this pull request Nov 9, 2026
fix(make): stop re-running multi-output actions on every build nodejs/gyp-next#369
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@addaleax addaleax addaleax approved these changes
@cjihrig cjihrig cjihrig approved these changes
+2 more reviewers
@refack refack refack approved these changes
@danbev danbev danbev approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

build Issues and PRs related to Node.js builds or CI infrastructure. fast-track PRs proposed for a shorter-than-standard waiting period before landing. regression Issues related to regressions. tools Issues and PRs related to the tools directory.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

make with -j hangs

Uh oh!

There was an error while loading. Please reload this page.

7 participants

@thefourtheye @nodejs-github-bot @danbev @refack @addaleax @devsnek @cjihrig
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.