Skip to content

Conversation

@ronag
Copy link
Member

Basically what the close(2) man page says – if it’s possible that the fd is being used for a syscall in one thread of the threadpool, we should not be calling close() concurrently.

Refs: #30864

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

@nodejs-github-botnodejs-github-bot added doc Issues and PRs related to the documentations. fs Issues and PRs related to the fs subsystem / file system. labels Dec 14, 2019
@ronag
Copy link
MemberAuthor

@addaleax

@ronag
Copy link
MemberAuthor

We might want to consider adding a ref count on fs ops and provide an unsafe version that does not do so (i.e. use at own risk but with better perf).

@ronag
Copy link
MemberAuthor

Is that disagreement or confusion on the previous comment?

@addaleax
Copy link
Member

@ronag It’s both … I feel like the suggestion misses a compelling reason to be implemented?

@ronag
Copy link
MemberAuthor

I feel like the suggestion misses a compelling reason to be implemented?

Consider the amount of users that are not aware of this quirk and are ending up unknowingly with code with undefined behaviour.

I'm also sceptical whether that's compelling enough. Probably isn't as bad in practice as I make it sound. Just thought it might be worth to consider.

Copy link
Member

@TrottTrott left a comment

Choose a reason for hiding this comment

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

LGTM with two small suggestions applied.

ronagand others added 2 commits December 15, 2019 01:22
Co-Authored-By: Rich Trott <[email protected]>
Co-Authored-By: Rich Trott <[email protected]>
@ronag
Copy link
MemberAuthor

ronag commented Dec 15, 2019

Added note to closeSync as well.

@BridgeARBridgeAR added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Dec 15, 2019
@BridgeAR
Copy link
Member

Trott pushed a commit that referenced this pull request Dec 17, 2019
Add notes to fs.close and fs.closeSync() about udnefined behavior. PR-URL: #30966 Refs: #30864 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
@Trott
Copy link
Member

Landed in b376965

@TrottTrott closed this Dec 17, 2019
MylesBorins pushed a commit that referenced this pull request Dec 17, 2019
Add notes to fs.close and fs.closeSync() about udnefined behavior. PR-URL: #30966 Refs: #30864 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
@MylesBorinsMylesBorins mentioned this pull request Dec 17, 2019
targos pushed a commit that referenced this pull request Jan 14, 2020
Add notes to fs.close and fs.closeSync() about udnefined behavior. PR-URL: #30966 Refs: #30864 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
@targostargos mentioned this pull request Jan 15, 2020
BethGriggs pushed a commit that referenced this pull request Feb 6, 2020
Add notes to fs.close and fs.closeSync() about udnefined behavior. PR-URL: #30966 Refs: #30864 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
@MylesBorinsMylesBorins mentioned this pull request Feb 8, 2020
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.docIssues and PRs related to the documentations.fsIssues and PRs related to the fs subsystem / file system.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@ronag@addaleax@BridgeAR@Trott@jasnell@lpinca@nodejs-github-bot