Skip to content

Conversation

@danxuliu
Copy link
Member

Backport of #9245

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 <[email protected]>
@codecov
Copy link

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%> (ø) ⬇️

Copy link
Member

@MorrisJobke MorrisJobke left a comment

Choose a reason for hiding this comment

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

🐘

@MorrisJobke MorrisJobke merged commit edd5712 into stable13 May 14, 2018
@MorrisJobke MorrisJobke deleted the stable13-9245-fix-race-condition-when-preparing-upload-folder branch May 14, 2018 11:41
@MorrisJobke MorrisJobke mentioned this pull request May 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants