Skip to content
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

fs: validate fd synchronously on c++ #51027

Merged
merged 1 commit into from
Dec 18, 2023

Conversation

anonrig
Copy link
Member

@anonrig anonrig commented Dec 3, 2023

This PR moves all getValidatedFd calls to C++. Improves error path performance by ~17-42%.

Benchmark CI: https://ci.nodejs.org/view/Node.js%20benchmark/job/benchmark-node-micro-benchmarks/1482/

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. fs Issues and PRs related to the fs subsystem / file system. needs-ci PRs that need a full CI run. labels Dec 3, 2023
@targos
Copy link
Member

targos commented Dec 3, 2023

It is semver-major, and would be a very disruptive change, especially if it happens incrementally. It's been a general rule for a long time in Node.js that validation happens synchronously.

@targos targos added the semver-major PRs that contain breaking changes and should be released in the next major version. label Dec 3, 2023
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

I'm -1 for the reasons mentioned by @targos.

@tniessen
Copy link
Member

tniessen commented Dec 3, 2023

See also #49970, which is blocked on the same problem as far as I am aware.

@anonrig anonrig changed the title fs: move validateFd to c++ fs: validate fd for sync calls on c++ Dec 3, 2023
@anonrig
Copy link
Member Author

anonrig commented Dec 3, 2023

@mcollina @tniessen @targos I've updated the PR to remove server-major changes. We now validate only on sync call paths. This change will also allow us to move async function to C++ and potentially eliminate the usage of FSReqWrap so that we can throw the errors synchronously from C++.

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

@anonrig anonrig removed the semver-major PRs that contain breaking changes and should be released in the next major version. label Dec 3, 2023
@anonrig anonrig changed the title fs: validate fd for sync calls on c++ fs: validate fd synchronously on c++ Dec 5, 2023
@anonrig anonrig force-pushed the validate-fd branch 5 times, most recently from d406848 to 7935836 Compare December 5, 2023 17:30
@anonrig
Copy link
Member Author

anonrig commented Dec 5, 2023

cc @nodejs/fs @nodejs/cpp-reviewers

@anonrig anonrig added the request-ci Add this label to start a Jenkins CI on a PR. label Dec 5, 2023
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Dec 5, 2023
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

src/util.cc Outdated Show resolved Hide resolved
lib/fs.js Show resolved Hide resolved
@anonrig anonrig added the request-ci Add this label to start a Jenkins CI on a PR. label Dec 12, 2023
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Dec 12, 2023
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@anonrig anonrig added the request-ci Add this label to start a Jenkins CI on a PR. label Dec 15, 2023
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Dec 15, 2023
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

@nodejs-github-bot
Copy link
Collaborator

@anonrig anonrig added the commit-queue Add this label to land a pull request using GitHub Actions. label Dec 18, 2023
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Dec 18, 2023
@nodejs-github-bot nodejs-github-bot merged commit 65e70bf into nodejs:main Dec 18, 2023
54 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in 65e70bf

RafaelGSS pushed a commit that referenced this pull request Jan 2, 2024
PR-URL: #51027
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
@RafaelGSS RafaelGSS mentioned this pull request Jan 2, 2024
richardlau pushed a commit that referenced this pull request Mar 25, 2024
PR-URL: #51027
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
@richardlau richardlau mentioned this pull request Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ Issues and PRs that require attention from people who are familiar with C++. fs Issues and PRs related to the fs subsystem / file system. needs-ci PRs that need a full CI run.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants