Closed (fixed)
Project:
Drupal core
Version:
8.7.x-dev
Component:
phpunit
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
14 Mar 2019 at 09:48 UTC
Updated:
3 Jun 2019 at 07:32 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
lendudeYeah I don't see any other way to prevent this either unless we somehow make run-tests.sh responsible for this since that is the only part running outside the concurrency (and no, I don't think that would be a good idea even if we could get that to work!)
Comment #3
cilefen commentedWould this technique help?
Comment #4
moshe weitzman commentedI'm having this problem as well. See recent test fails at #3046467: Devel_Generate tests: Port to BrowserTestBase and add Drush command coverage. I've also seen them at #2999914: Update Dependencies Format in .info.yml, https://www.drupal.org/pift-ci-job/1132230, https://www.drupal.org/pift-ci-job/1063933, https://www.drupal.org/pift-ci-job/1068930
Comment #5
jonathan1055 commentedAlso see the two-years older issue #2845122: mkdir(): File exists in BrowserHtmlDebugTrait.php:141 during BrowserTestBase, which has now been closed as a duplicate of this one.
Comment #6
mile23The link in #3 looks like a good solution, suggesting
!is_dir($folder) && !mkdir($folder) && !is_dir($folder).Comment #7
willzyx commentedThis is causing 30% of times test failures in devel
Comment #8
willzyx commentedMoving to major (even if Priority levels of issues evaluation suggests to mark it as critical because of: Cause race conditions, database deadlocks etc. for which even code with 100% automated test coverage may be affected)
Comment #9
mile23LGTM
Comment #10
catchCommitted/pushed to 8.8.x and cherry-picked to 8.7.x, thanks!
Comment #13
oriol_e9gCan we add a comment? It's not trivial to understand why we are adding is_dir two times.
Comment #14
oriol_e9gTypo. Sorry.
Comment #15
oriol_e9gComment #16
berdirYeah, that was a fast commit :)
I'm also wondering if this should be part of \Drupal\Core\File\FileSystem::mkdir(), and this trait should use that instead of calling mkdir() directly, then it would also solve #3036494: Race condition in ImageStyle::createDerivative().
Comment #18
catchThose are good points. Reverted from both branches for now, let's keep going here.
Comment #20
mile23Fast commits are good. :-)
Yah so basically this is killing Examples HEAD: https://www.drupal.org/pift-ci-job/1266550
It should be added to 8.6.x, so I can at least fix Examples.
I couldn't apply #14 so here it is with what I think is a clearer explanation.
Re: #16 and using FileSystem, see:
It would make a good follow-up to add this to the service, though.
Comment #21
borisson_The patch doesn't look very simple, but the comment explains it enough so that I can understand why this code was added. It also seems like it would fix random failures I've seen in the facets module over the last couple of months.
I agree with @Mile23, I think #16 is really well suited to being a followup.
Comment #22
berdir+1, we can move the change in my issue referenced in #16 to FileSystem.
Comment #23
mile23'Build Successful' fail seems unrelated:
Re-starting test.
Comment #24
jonathan1055 commentedWith reference to Berdir's comments in #16 and #22 I've put this it 'needs work' not RTBC.
Comment #25
berdirI think you misunderstood my comment, #20 explains why we can't use FileSystem, and we already have an issue then to do there, so no follow-up needed.
Comment #26
alexpottWe've got a good comment now and this approach seems fine for test only code.
Committed and pushed 2628528d0b to 8.8.x and 1f9a1b643d to 8.7.x. Thanks!
As a major bug backported to 8.7.x
Comment #29
jonathan1055 commentedThanks for all your work on this. Now that the commits are in 8.8.x and 8.7.x would you still expect to see this error happening? I had a daily test fail today with this problem https://www.drupal.org/pift-ci-job/1275084
Line 143 is the new line of code in BrowserHtmlDebugTrait.php not the old line, so that shows that the new version is being run.
Comment #31
borisson_Got a new instance of this just a few hours ago in facets: https://www.drupal.org/pift-ci-job/1288919
Comment #32
jonathan1055 commentedIs the newly-committed code fix working as expected here? If it failed we should see the exception
But instead we just get the same old original error
Do we need to open a new issue, as ordinary users cannot re-open this one.
Comment #33
cilefen commentedComment #34
lendudeI think the problem here is that mkdir still emits a warning, so to stop the test from failing we need to suppress that warning on top of the previous additions.
Comment #35
borisson_Ah yeah that would make sense. This is really hard to test if this actually fixes it since it’s a random fail. The patch in #34 does look good though, it should be enough to make the errors go away.
Comment #36
borisson_The patch by @Lendude is green. Setting this issue back to rtbc.
Comment #37
alexpottCommitted and pushed 1ffbb8ebd7 to 8.8.x and bc19eaea37 to 8.7.x. Thanks!
Comment #41
ndobromirov commentedHow to use that on 8.6?
There is no bulk patch with the whole fix :(