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

Check for ID before creating a new record #78

Merged
merged 3 commits into from
Apr 16, 2024

Conversation

Zsailer
Copy link
Member

@Zsailer Zsailer commented Apr 12, 2024

I've seen a race condition appear when this extension is enabled in a server that has another extension using the file ID service in parallel.

My other extension is also watching updates to the file and trigger an .get_id(...) call on a file when changes are made. If a file is, e.g. copied, the new file will have my extension and the file ID extension competing to set the new ID.

To avoid errors thrown by the "Unique" constraint in the ArbitraryFileManager, I would like to propose that we check for an existing file ID in the _create method before assigning a new UUID.

@Zsailer Zsailer added the bug Something isn't working label Apr 12, 2024
@Zsailer Zsailer changed the title Check for ID before recording a record Check for ID before creating a new record Apr 12, 2024
Copy link
Collaborator

@dlqqq dlqqq left a comment

Choose a reason for hiding this comment

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

Thank you! Left a minor comment.

jupyter_server_fileid/manager.py Outdated Show resolved Hide resolved
@Zsailer Zsailer requested a review from dlqqq April 16, 2024 03:16
@Zsailer Zsailer merged commit d2f50ea into jupyter-server:main Apr 16, 2024
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants