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

Free resources in preview providers #30507

Merged
merged 1 commit into from
Feb 19, 2018
Merged

Free resources in preview providers #30507

merged 1 commit into from
Feb 19, 2018

Conversation

VicDeo
Copy link
Member

@VicDeo VicDeo commented Feb 16, 2018

Description

Dispose unneeded resources ASAP

Related Issue

#30506

Motivation and Context

Driven by random build failures

How Has This Been Tested?

Not tested in general as original issue is a Heisenbug
So I just checked that previews are still shown for affected mimes

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@VicDeo VicDeo added this to the development milestone Feb 16, 2018
@VicDeo
Copy link
Member Author

VicDeo commented Feb 16, 2018

@PVince81 could be the reason.

@codecov
Copy link

codecov bot commented Feb 16, 2018

Codecov Report

Merging #30507 into master will decrease coverage by <.01%.
The diff coverage is 62.5%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #30507      +/-   ##
============================================
- Coverage     61.59%   61.59%   -0.01%     
  Complexity    18505    18505              
============================================
  Files          1090     1090              
  Lines         61104    61108       +4     
============================================
+ Hits          37640    37642       +2     
- Misses        23464    23466       +2
Impacted Files Coverage Δ Complexity Δ
lib/private/Preview/SVG.php 0% <0%> (ø) 7 <0> (ø) ⬇️
lib/private/Preview/Bitmap.php 79.16% <100%> (+0.9%) 8 <0> (ø) ⬇️
lib/private/Preview/TXT.php 78.12% <100%> (+0.7%) 9 <0> (ø) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d9eb7fe...371f2be. Read the comment docs.

@phil-davis
Copy link
Contributor

I did some tests of the "randomly failing" upload UI test suite. When looking at test runs, I saw that quite often in the ordinary run through all the test scenarios, upload.feature:69 fails (presumably with the file locked issue). The UI test script reruns any failed scenario, and quite often that test passes when it is rerun. The proportions are about right for the observed "random failure" rate.

PR #30509 - on master there was a failure in the full upload suite run 14/30 times. 47%
The rerun of the failed scenario failed again 4/14 times. 29%

PR #30510 - doing lots of upload test suite runs on top of this PR. 42%
there was a failure on the full upload suite run 25/60 times.
The rerun of the failed scenario failed again 8/25 times. 32%

So there is no very much difference without without this PR.

This PR is still "a good looking thing". It just does not seem to make a big difference to the time window when the file is locked while generating a preview.

Copy link
Contributor

@PVince81 PVince81 left a comment

Choose a reason for hiding this comment

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

In general it's not a good idea to rely on PHP's garbage collector to close files as it might happen much later than expected and different PHP versions behave differently.

So this is a great step forward, let's merge this unless it breaks other things 👍

@PVince81
Copy link
Contributor

If UI tests still fail randomly then maybe there is yet another undiscovered code path related to previews. @VicDeo does the preview as requested from the URL go through other code paths not covered here ?

@phil-davis
Copy link
Contributor

The random failures that I can see are actually genuine. The file on the server has to be read-locked while the server reads it to make the preview thumbnail. During that time, requests to overwrite/delete etc are going to get a "file locked" response.

UI tests have been enhanced to handle that case, looking for the "file locked" notfication on the UI - PR #30513 - it is just waiting for CI to finish again after some minor code format review changes.

@phil-davis
Copy link
Contributor

IMO this [can|should] be merged - @PVince81 press that button if you are happy.

@PVince81 PVince81 merged commit 3b420d6 into master Feb 19, 2018
@PVince81 PVince81 deleted the a-pack-of-fclose branch February 19, 2018 10:45
@PVince81
Copy link
Contributor

please backport this fix

@VicDeo
Copy link
Member Author

VicDeo commented Feb 19, 2018

Stable10: #30533

@lock
Copy link

lock bot commented Aug 1, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants