Skip to content

doc: remove --expose-gc flag from CLI documentation#58909

Open
dario-piotrowicz wants to merge 1 commit into
nodejs:mainfrom
dario-piotrowicz:dario/remove-expose-gc-from-cli
Open

doc: remove --expose-gc flag from CLI documentation#58909
dario-piotrowicz wants to merge 1 commit into
nodejs:mainfrom
dario-piotrowicz:dario/remove-expose-gc-from-cli

Conversation

@dario-piotrowicz
Copy link
Copy Markdown
Member

The CLI documentation for --expose-gc has been added in #53078

However it's removal was requested in #53078 (comment) (since this is not something users should generally rely on), but the documentation wasn't fully removed from the PR before it landed.

So I believe that the flag being documented might have been an oversight.

Original context: #58878 (comment)


Note: I'm trying to figure out here if --expose-gc should or not be documented in the CLI documentation, and if it should be I would be inclined to also include it in the manpage for consistency πŸ€”


Note: I wanted to also mention that the flag is also included in the allowed v8 options and the useful v8 options
(meaning that even after removing the cli flag section some references to it, for advanced users, will still be present in the document)

@nodejs-github-bot nodejs-github-bot added cli Issues and PRs related to the Node.js command line interface. doc Issues and PRs related to the documentations. labels Jun 30, 2025
Copy link
Copy Markdown
Member

@jakecastelli jakecastelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one feels similar to the --expose-internals CLI flag which exists but not documented.

We use --expose-internals exclusively in Core for various testing purposes but outside of core development it is not encouraged.

@juanarbol
Copy link
Copy Markdown
Member

However it's removal was requested in #53078 (comment) (since this is not something users should generally rely on), but the documentation wasn't fully removed from the PR before it landed.

The docs are pretty much the usage at runtime and what is does (the idea behind documenting stuff), which is inherit from V8. I did not introduced the flag per se, I just added it to the CLI available options, I don't think we should remove the documentation, when the documentation is just showing the usage and that it is part of the available CLI options.

I don't think it is the right thing to do, each flag should be documented; but feel free to land this; I'm not blocking anything.

@dario-piotrowicz
Copy link
Copy Markdown
Member Author

However it's removal was requested in #53078 (comment) (since this is not something users should generally rely on), but the documentation wasn't fully removed from the PR before it landed.

The docs are pretty much the usage at runtime and what is does (the idea behind documenting stuff), which is inherit from V8. I did not introduced the flag per se, I just added it to the CLI available options, I don't think we should remove the documentation, when the documentation is just showing the usage and that it is part of the available CLI options.

I don't think it is the right thing to do, each flag should be documented; but feel free to land this; I'm not blocking anything.

Hey @juanarbol πŸ™‚

Thanks a lot for chipping in πŸ™

I see your point but I also see that we have various v8 flags that are not documented (and some that are) so I do believe that there's unclarity on this πŸ€”

I think that ideally we should only document the flags that node specifically implements, the V8 flags that it supports should be just listed (as they are here: available v8 options)

And the nodejs docs should simply then refer to the the V8 official documentation regarding the flags that it supports...

The problem being that I can't seem to find any official V8 documentation regarding the supported flags... any idea if there is one? 🫀

@juanarbol
Copy link
Copy Markdown
Member

juanarbol commented Jul 3, 2025

The V8 team is not that good documenting flags as well. From my personal experience, I just have to look at this file https://github.com/v8/v8/blob/b5b7de9cc158c9d4dc038841e5935c49e4764d7e/src/flags/flag-definitions.h#L2594

Again, this is not a blocker, but I don't see this adding any actual value but making things a bit more confusing. I know Node.js has a mess w/ node options and CLI options, but removing docs is not the answer IMHO.

However it's removal was requested in #53078 (comment) (since this is not something users should generally rely on), but the documentation wasn't fully removed from the PR before it landed.

The requested removal of the docs was something about V8 I wrote about. Not the CLI entry and usage.

@dario-piotrowicz
Copy link
Copy Markdown
Member Author

The V8 team is not that good documenting flags as well. From my personal experience, I just have to look at this file https://github.com/v8/v8/blob/b5b7de9cc158c9d4dc038841e5935c49e4764d7e/src/flags/flag-definitions.h#L2594

I see, that's a useful link to know about, thank you very much πŸ™

Again, this is not a blocker, but I don't see this adding any actual value but making things a bit more confusing. I know Node.js has a mess w/ node options and CLI options, but removing docs is not the answer IMHO.

Thanks a lot, I really appreciate the input πŸ™‚ , personally I see the argument both ways, if we think that this is a foot gun and not something people should be using then it makes sense to me that we don't publicly document it, on the other hand if it is something that node provides it does make sense to document that...

I would have hoped for more people to chip in here πŸ˜… , hopefully someone else will tipping the scale in either direction 🀞

@aduh95
Copy link
Copy Markdown
Contributor

aduh95 commented Nov 8, 2025

Should we move it to https://nodejs.org/api/cli.html#useful-v8-options?

@joyeecheung
Copy link
Copy Markdown
Member

I think moving it to the useful V8 options section would be the right move - it's not up to Node.js to decide how it behaves, so it shouldn't be documented like other Node.js options.

FWIW the existing documentation is somewhat misleading - it would make you think that this triggers a blocking GC that's supposed to clean up all remaining unreachable objects, but that's not the case and even has been the cause of some of our flakes. That function only triggers one GC, and one single GC does not guarantee to clean up everything especially when there are weak references or ephemeron pairs in the graph.

@jakecastelli
Copy link
Copy Markdown
Member

+1 on Joyee's suggestion

Copy link
Copy Markdown
Contributor

@aduh95 aduh95 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's already in Useful V8 Options section:

### `--expose-gc`

@aduh95 aduh95 added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. commit-queue Add this label to land a pull request using GitHub Actions. labels May 19, 2026
@nodejs-github-bot nodejs-github-bot added commit-queue-failed An error occurred while landing this pull request using GitHub Actions. and removed commit-queue Add this label to land a pull request using GitHub Actions. labels May 19, 2026
@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

Commit Queue failed
- Loading data for nodejs/node/pull/58909
βœ”  Done loading data for nodejs/node/pull/58909
----------------------------------- PR info ------------------------------------
Title      doc: remove `--expose-gc` flag from CLI documentation (#58909)
Author     Dario Piotrowicz <dario.piotrowicz@gmail.com> (@dario-piotrowicz)
Branch     dario-piotrowicz:dario/remove-expose-gc-from-cli -> nodejs:main
Labels     doc, cli, author ready
Commits    1
 - doc: remove `--expose-gc` flag from CLI documentation
Committers 1
 - Dario Piotrowicz <dario.piotrowicz@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/58909
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
------------------------------ Generated metadata ------------------------------
PR-URL: https://github.com/nodejs/node/pull/58909
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
--------------------------------------------------------------------------------
   β„Ή  This PR was created on Mon, 30 Jun 2025 22:24:25 GMT
   βœ”  Approvals: 2
   βœ”  - Jake Yuesong Li (@jakecastelli): https://github.com/nodejs/node/pull/58909#pullrequestreview-2975252574
   βœ”  - Antoine du Hamel (@aduh95) (TSC): https://github.com/nodejs/node/pull/58909#pullrequestreview-4323953013
   βœ”  Last GitHub CI successful
   β„Ή  Green GitHub CI is sufficient
--------------------------------------------------------------------------------
   βœ”  No git cherry-pick in progress
   βœ”  No git am in progress
   βœ”  No git rebase in progress
--------------------------------------------------------------------------------
- Bringing origin/main up to date...
From https://github.com/nodejs/node
 * branch                  main       -> FETCH_HEAD
βœ”  origin/main is now up-to-date
- Downloading patch for 58909
From https://github.com/nodejs/node
 * branch                  refs/pull/58909/merge -> FETCH_HEAD
βœ”  Fetched commits as 4f4077a299f1..154d819b56da
--------------------------------------------------------------------------------
Auto-merging doc/api/cli.md
[main c106c49288] doc: remove `--expose-gc` flag from CLI documentation
 Author: Dario Piotrowicz <dario.piotrowicz@gmail.com>
 Date: Mon Jun 30 23:02:40 2025 +0100
 1 file changed, 19 deletions(-)
   βœ”  Patches applied
--------------------------------------------------------------------------------
--------------------------------- New Message ----------------------------------
doc: remove `--expose-gc` flag from CLI documentation

PR-URL: #58909
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>

[main 7fd1141b43] doc: remove --expose-gc flag from CLI documentation
Author: Dario Piotrowicz <dario.piotrowicz@gmail.com>
Date: Mon Jun 30 23:02:40 2025 +0100
1 file changed, 19 deletions(-)
βœ– 7fd1141b43e8aa6158de6b4785b6e51960a8b4d6
βœ” 0:0 no Assisted-by metadata assisted-by-is-trailer
βœ” 0:0 no Co-authored-by metadata co-authored-by-is-trailer
βœ” 0:0 skipping fixes-url fixes-url
βœ” 0:0 blank line after title line-after-title
βœ” 0:0 line-lengths are valid line-length
βœ” 0:0 metadata is at end of message metadata-end
βœ” 1:8 PR-URL is valid. pr-url
βœ” 0:0 reviewers are valid reviewers
βœ– 0:0 Commit must have a "Signed-off-by" trailer signed-off-by
βœ” 0:0 valid subsystems subsystem
βœ” 0:0 Title is formatted correctly. title-format
⚠ 0:50 Title should be <= 50 columns. title-length

β„Ή Please fix the commit message and try again.
Please manually ammend the commit message, by running
git commit --amend
Once commit message is fixed, finish the landing command running
git node land --continue

https://github.com/nodejs/node/actions/runs/26131088912

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no pending requests for changes, and a CI started. cli Issues and PRs related to the Node.js command line interface. commit-queue-failed An error occurred while landing this pull request using GitHub Actions. doc Issues and PRs related to the documentations.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants