-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Address potential races in fs.read
and fs.seek
operations
#3420
Address potential races in fs.read
and fs.seek
operations
#3420
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## experimental/fs-readseek #3420 +/- ##
===========================================================
Coverage ? 73.21%
===========================================================
Files ? 263
Lines ? 20101
Branches ? 0
===========================================================
Hits ? 14716
Misses ? 4448
Partials ? 937
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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, added a comment regarding f.size usage polish, and to make explicit the assumption we are making regarding the concurrent use of Read and Seek.
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, mostly waiting for the TODO comment as expressed on #3420 (comment)
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.
I have left some none blocking comments
What?
This Pull Request aims to address #3354, and avoid data races involved in using the currently proposed implementation of
fs.read
andfs.seek
.Why?
Namely, it modifies the behavior of the proposed
fs.read
andfs.seek
methods to avoid data races due to:fs.read
buffer argument concurrentlyIn a nutshell, we addressed 1 by ensuring that the provided buffer was only modified from the JS runtime's main thread, by performing it as a side-effect of the promise resolution's. We addressed 2 by making sure the internal file structure's offset is an atomic int that cannot, as a result, be modified by two concurrent operations at the same time.
Checklist
make lint
) and all checks pass.make tests
) and all tests pass.Related PR(s)/Issue(s)
ref #3309
ref #2974
closes #3354