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

[stable13] Fix race condition when preparing upload folder #9454

merged 1 commit into from May 14, 2018


None yet
3 participants

danxuliu commented May 10, 2018

Backport of #9245

Fix race condition when preparing upload folder
Before any upload is submitted the upload is registered in a list of
known uploads; this is needed to retrieve the upload object at several
points of the upload process. When a chunked upload is submitted first a
directory to upload all the chunks is created and, once that is done,
the chunks are sent; in order to send a chunk the upload object needs to
be retrieved from the list of known uploads.

When all the active uploads were finished the list of known uploads was
cleared. However, an upload is not active until it actually starts
sending the data, so while waiting for the upload directory to be
created the upload is already in the list of known uploads yet not
active. Due to all this, if the active uploads finished while another
pending upload was waiting for the upload directory to be created that
pending upload would be removed from the list of known uploads too, and
once the directory was created and thus the chunks were sent a field of
a null upload object would be accessed thus causing a failure.

Instead of removing all the known uploads at once when the active
uploads finish now each upload is explicitly removed when it finishes.

Signed-off-by: Daniel Calviño Sánchez <>

This comment has been minimized.

codecov bot commented May 10, 2018

Codecov Report

Merging #9454 into stable13 will increase coverage by <.01%.
The diff coverage is n/a.

@@              Coverage Diff               @@
##             stable13    #9454      +/-   ##
+ Coverage       51.36%   51.36%   +<.01%     
  Complexity      25051    25051              
  Files            1609     1609              
  Lines           95348    95348              
  Branches         1376     1376              
+ Hits            48974    48976       +2     
+ Misses          46374    46372       -2
Impacted Files Coverage Δ Complexity Δ
core/js/js.js 66.48% <0%> (+0.11%) 0% <0%> (ø) ⬇️
lib/private/Files/Cache/Propagator.php 96.2% <0%> (+1.26%) 16% <0%> (ø) ⬇️


@MorrisJobke MorrisJobke merged commit edd5712 into stable13 May 14, 2018

4 checks passed

codecov/patch Coverage not affected when comparing 3a013b1...d74b523
codecov/project 51.36% (+<.01%) compared to 3a013b1
continuous-integration/drone/pr the build was successful
continuous-integration/drone/push the build was successful

@MorrisJobke MorrisJobke deleted the stable13-9245-fix-race-condition-when-preparing-upload-folder branch May 14, 2018

@MorrisJobke MorrisJobke referenced this pull request May 31, 2018


13.0.3 RC 1 #9700

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