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

Multiple Readers and Writers in File System Access API #845

Closed
1 task done
dslee414 opened this issue May 18, 2023 · 5 comments
Closed
1 task done

Multiple Readers and Writers in File System Access API #845

dslee414 opened this issue May 18, 2023 · 5 comments
Assignees
Labels
Progress: review complete Resolution: satisfied The TAG is satisfied with this design Review type: CG early review An early review of general direction from a Community Group Topic: Filesystem Venue: WHATWG Venue: WICG

Comments

@dslee414
Copy link

こんにちは TAG-さん!

I'm requesting a TAG review of Multiple Readers and Writers in File System Access API.

Currently, only one FileSystemSyncAccessHandle may be open at a time per file, preventing an origin from reading the same file from multiple tabs easily. Conversely, multiple FileSystemWritableFileStream can be simultaneously open, letting multiple writers clobber each other.

Introducing new “create” modes for FileSystemSyncAccessHandle and FileSystemWritableFileStream allows opening either multiple readers/writers or an exclusive writer to a file entry, depending on the application's use case.

handle.createSyncAccessHandle({ mode: 'read-only' });
handle.createWritable({ mode: ‘exclusive’ });

Further details:

You should also know that…

  • FileSystemSyncAccessHandle is available only on Bucket File System (a.k.a. Origin Private File System), while FileSystemWritableFileStream is available on both Bucket File System (implemented in Blink, Gecko, WebKit) and local file system (Chromium-only).
  • We think that adding an optional dictionary is probably not controversial, and adding modes like shared read-only, exclusive readwrite, and (unsafe) shared readwrite are common across native file system APIs, but feedback on the specific enum strings would be especially welcome.
  • Also, we think that preventing modification of a parent directory via shared lock would be desired, as a file entry is represented by a file path; however, native file system behavior on this varies, and feedback on this is welcome.

We'd prefer the TAG provide feedback as:

🐛 open issues in our GitHub repo for each point of feedback

@dslee414 dslee414 added Progress: untriaged Review type: CG early review An early review of general direction from a Community Group labels May 18, 2023
@torgo torgo added this to the 2023-05-29-week milestone May 24, 2023
@fergald
Copy link

fergald commented Jun 2, 2023

Security and Privacy self-review: No changes introduced to the existing review (WICG/file-system-access/security-privacy-questionnaire.md)

The questionnaire has changed somesince then, for example the old questionnaire does not cover BFCache. We're discussing that elsewhere but there may be other changed to the questionnaire that make it worth revisiting.

@cynthia
Copy link
Member

cynthia commented Aug 1, 2023

We briefly discussed this during our F2F, overall - this looks good. However, we couldn't see how the lock is expected to behave when the document becomes not fully active, or if the rug is pulled from underneath (e.g. crash). Effectively, there doesn't seem to be a mechanism in place for recovery; or getting out of a stale lock state. Could you elaborate on what you have in mind here and possibly add that to the explainer?

Also, the other implementer signal is a pointer to a long thread, where we can't really identify who is from which implementer. It would be helpful if there was at least a pointer to the actual comment from each implementer. (Ideally we'd want to see a standards position.)

@torgo torgo modified the milestones: 2023-07-24-week, 2023-08-07-week Aug 1, 2023
@nathanmemmott
Copy link

We briefly discussed this during our F2F, overall - this looks good. However, we couldn't see how the lock is expected to behave when the document becomes not fully active, or if the rug is pulled from underneath (e.g. crash). Effectively, there doesn't seem to be a mechanism in place for recovery; or getting out of a stale lock state. Could you elaborate on what you have in mind here and possibly add that to the explainer?

For a page crash, all locks associated with that page will be maintained by a process associated with the user agent. So if the user agent crashes the lock is released. This is similar to how flock is owned by the file descriptor, so if the process that owns the file descriptor crashes, then the lock is released when the file descriptor is unallocated (https://man7.org/linux/man-pages/man2/flock.2.html).

Interaction with BFCache is already an issue without introducing the new locking scheme and is discussed here: whatwg/fs#17. From that discussion, we'd like to evict a page in BFCache only on contention of a fully active page's FSA locks with the BFCached page's FSA locks. I'll update the explainer to have a section explaining that.

Also, the other implementer signal is a pointer to a long thread, where we can't really identify who is from which implementer. It would be helpful if there was at least a pointer to the actual comment from each implementer. (Ideally we'd want to see a standards position.)

We forgot to request standards positions. I'll do that now!

@cynthia
Copy link
Member

cynthia commented Aug 5, 2023

Thanks for the quick response. We'll wait for the updates and standards position - let's resume the discussion when we have those.

@torgo torgo modified the milestones: 2023-09-25-week, 2023-10-09-week Oct 8, 2023
@torgo torgo removed the Missing: Multi-stakeholder support Lack of multi-stakeholder support label Oct 10, 2023
@torgo torgo removed this from the 2023-10-09-week milestone Oct 10, 2023
@cynthia
Copy link
Member

cynthia commented Oct 10, 2023

Given the response above, and the multiple stakeholder support, we're happy to see this proposal move forward. Thanks for bringing this to our attention!

@cynthia cynthia added Resolution: satisfied The TAG is satisfied with this design Progress: review complete labels Oct 10, 2023
@cynthia cynthia closed this as completed Oct 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Progress: review complete Resolution: satisfied The TAG is satisfied with this design Review type: CG early review An early review of general direction from a Community Group Topic: Filesystem Venue: WHATWG Venue: WICG
Projects
None yet
Development

No branches or pull requests

6 participants