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

Concurrent file uploads resulting in the same file version #59

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

derjust
Copy link
Contributor

@derjust derjust commented Oct 8, 2014

Hi all,
we spotted a issue with the way how the file version is calculated while a lot of clients (>10) uploading small files in parallel:

The safeName() method creates correctly a new file version name but does not touches the 'calculated' file name. Plus the 'begin' event is fired later on.
This mean if a second fileBegin event is at the very same position and is executed (before the 'begin' of the first request is handled) the second safeName() calculates the very same version.

To avoid this, i added an touch for the created file.

This solution is fine for one process working on a upload folder. But we have many node processes handling requests (behind an IIS via iisnode) therefore even that touching might not be possible as two processes reach that code in the very same moment (assuming a multicore system).

Therefore an option prefixUuid has been created to allow the files to be created with a prefix. This new name is returned to the client as the versionized file name would be, too.

@derjust derjust changed the title Avoid Concurrent file uploads resulting in the same file version Concurrent file uploads resulting in the same file version Oct 8, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant