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

Add constraints fore saving/reading files #1416

Open
davidbrochart opened this issue Apr 16, 2024 · 0 comments
Open

Add constraints fore saving/reading files #1416

davidbrochart opened this issue Apr 16, 2024 · 0 comments

Comments

@davidbrochart
Copy link
Contributor

Problem

Currently the default (async) file manager allows to save a file and to read it concurrently. If this happens, the read file content will probably not consist of the whole file, but a part of it.
Also, since save() is async, it could be cancelled in the middle, which will likely corrupt the file.

Proposed Solution

I am wondering if writing a file should prevent reading it at the same time. Also, I think that writing a file should be shielded from cancellation.
I think these constraints should be enforced here in jupyter-server, since this would avoid lots of issues upstream when using these methods. We could for instance use a file path based locking mechanism for preventing reading-while-writing.

Additional context

jupyter-collaboration shields write operations here, and uses locks for preventing reading-while-writing.

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

No branches or pull requests

1 participant