Problem/Motivation

THINGS WE *THOUGHT* WERE CAUSING THE PROBLEM BUT WERE NOT
Test patches within this issue have ruled out several causes as they demonstrate:

  • The failures are not specific to a database type, but the nature of the failures can differ.
  • The failures occur even when running at single concurrency
  • The failures regardless of how long a wait is provided for the process to complete

Details
This was discovered while working on #3055648: Frequent random fail in \Drupal\Tests\media_library\FunctionalJavascript\MediaLibraryTest. There are a few random failures that persist regardless of how the test is refactored. They are all related to the file upload widget failing in some manner, typically on the transition from uploading an image to rebuilding to display form fields for the image's Alternative text. In the Media Library tests, these errors often first reveal themselves after an image is uploaded. The form that appears post-upload should include hidden fields with height and width values, but these values are occasionally empty. (when this occurs, a validation message about an incorrect primitive value appears, which is incorrectly attributed to the alt text field -- this is actually due to the empty width/height hidden fields)

@tedbow helped with a test that ruled out this being an issue related only to the image widget. The test in
article-100x-image-uploads.patch uploads and removes and image on the Article content type 100 times. These 100 attempts are made on the usual node add form, as well as a version where the node add form is inside a dialog. These tests do not fail.

Also attached is a test - media-widget-100-consecutive-uploads.patch - that consistently reproduces the problem (on testbot, the problem never occurs on localhost). There are 100 instances of a file being uploaded then removed via the Media Library widget. On MySql and Postgres, the tests nearly always fail within the iteration 47-48. On SQlite, the iterations are far less predictable, sometimes failing on the first iteration, and never getting further than 48 iterations before failing. It's unlikely that the tests in #3055648: Frequent random fail in \Drupal\Tests\media_library\FunctionalJavascript\MediaLibraryTest will reliably pass until the symptoms demonstrated in this test are addressed.

In the MySql and Postgres tests, the failures always happen during the same step: the test has added a file to the media upload field, but the JS-triggered upload process does not occur. This is a screenshot of when the test fails -- it is expecting the upload process to happen then see a form with the fields associated with this media.

On the SQLite tests, the failures can happen in different places, but most them happen after uploading the media, filling out the necessary fields then clicking "Save and select". The test then asserts that the text "Save and select" is longer present, but in some instances it is.

In other instances, the test fails because it can't find a remove button for the just-uploaded media. This screenshot taken during the fail shows that the widget was never rebuilt:

There are a few other assorted fails in SQlite, screenshots of each can be accessed by viewing the test on the dispatcher and downloading the test artifacts.

Proposed resolution

Not sure yet, but I'm hoping that the non-SQlite tests always failing at iteration 47-48 provide insight into why this is happening.

Remaining tasks

Determine cause of problem, fix.

User interface changes

N/A

API changes

N/A

Data model changes

N/A

Release notes snippet

N/A

CommentFileSizeAuthor
#68 500x_WidgetUploadTest.patch2.84 KBspokje
#65 WidgetUploadTest-no_#3350972-1000x-should_fail.patch2.26 KBspokje
#65 WidgetUploadTest-1000x.patch1.76 KBspokje
#64 WidgetUploadTest-no_#3350972-1500x-should_fail.patch2.26 KBspokje
#64 WidgetUploadTest-1500x.patch1.76 KBspokje
#57 WidgetUploadTest-50x-3066447-57.patch1.74 KBlauriii
#53 3066447-cke5randomfail-debug-53.patch2.83 KBwim leers
#53 3066447-cke5randomfail-53.patch1.84 KBwim leers
#44 3066447-44.patch25.91 KBoknate
#44 3066447--interdiff-43-44.txt3.91 KBoknate
#43 3066447-43.patch25.86 KBoknate
#43 3066447--interdiff-42-43.txt3.05 KBoknate
#42 3066447-42.patch30.58 KBoknate
#42 3066447--interdiff-41-42.txt7.49 KBoknate
#41 3066447-41.patch23.09 KBoknate
#41 3066447--interdiff-12-41.txt15.27 KBoknate
#40 3066447-40.patch23.41 KBoknate
#40 3066447--interdiff-39-40.txt675 bytesoknate
#39 3066447-39.patch22.75 KBoknate
#39 3066447--interdiff-38-39.txt1.76 KBoknate
#38 3066447-38.patch22.64 KBoknate
#38 3066447--interdiff-37-38.txt580 bytesoknate
#37 3066447-37.patch22.7 KBoknate
#37 3066447--interdiff-36-37.txt1.55 KBoknate
#36 3066447-36.patch22.66 KBoknate
#36 3066447--interdiff-35-36.txt5.77 KBoknate
#35 3066447-35.patch19.86 KBoknate
#35 3066447--interdiff-34-35.txt657 bytesoknate
#34 3066447-34.patch19.9 KBoknate
#34 3066447--interdiff-31-34.txt6.19 KBoknate
#33 3066447-33.patch19.94 KBoknate
#33 3066447--interdiff-32-33.txt1.52 KBoknate
#32 3066447-32.patch19.22 KBoknate
#32 3066447--interdiff-31-32.txt5.06 KBoknate
#31 3066447--interdiff-12-31.txt7.4 KBoknate
#31 3066447--interdiff-30-31.txt1.44 KBoknate
#31 3066447-31.patch16.19 KBoknate
#30 3066447-30.patch16.47 KBoknate
#30 3066447--interdiff-12-30.txt7.68 KBoknate
#29 3066447-29.patch15.89 KBoknate
#29 3066447--interdiff-12-29.txt6.48 KBoknate
#28 3066447-28.patch15.67 KBoknate
#28 3066447--interdiff-26-28.txt3.47 KBoknate
#27 all-files-upload-name.png95.58 KBoknate
#26 3066447-26.patch14.21 KBoknate
#26 3066447--interdiff-25-26.txt1.84 KBoknate
#25 3066447-25.patch53.09 KBoknate
#25 3066447--interdiff-24-25.txt748 bytesoknate
#24 3066447-24.patch53.09 KBoknate
#24 3066447--interdiff-12-24.txt3.16 KBoknate
#24 3066447--interdiff-23-24.txt2.13 KBoknate
#23 3066447-23.patch52.71 KBoknate
#23 3066447--interdiff-12-23.txt2.98 KBoknate
#21 two-uploads-first-is-removed-before-second-added-500X.patch18.26 KBbnjmnm
#21 two-uploads-500X.patch18.09 KBbnjmnm
#20 3066447-20.patch12.21 KBoknate
#20 3066447--interdiff-12-20.txt2.05 KBoknate
#19 duplicate-images.png607.93 KBoknate
#19 3066447-19.patch12.46 KBoknate
#19 3066447--interdiff-12-19.txt2.18 KBoknate
#18 3066447-18.patch12.15 KBoknate
#18 3066447--interdiff-12-18.txt1.66 KBoknate
#17 3066447-17-single-concurrency-uniq-filnames.patch12.16 KBoknate
#17 3066447--interdiff-16-17.txt5.25 KBoknate
#16 3066447-16-reload-page-test.patch12.08 KBoknate
#16 3066447--interdiff-14-16.txt2.18 KBoknate
#14 3066447-14-reload-page-test.patch12.11 KBoknate
#14 3066447--interdiff-12-14.txt925 bytesoknate
#12 3066447-12-single-concurrency-uniq-filnames.patch12.07 KBoknate
#11 3066447--interdiff-10-11.txt2.45 KBoknate
#10 3066447-10-single-concurrency-uniq-filnames.patch12.16 KBoknate
#7 interdiff_IS-7.txt3.21 KBbnjmnm
#7 3066447-7-single-concurrency-uniq-filnames.patch11.83 KBbnjmnm
#4 no-remove-button.jpg36.79 KBbnjmnm
#4 save-and-select-still-there.jpg72.1 KBbnjmnm
#4 screenshot-of-upload-that-does-not-trigger.jpg74 KBbnjmnm
article-100x-image-uploads.patch29.39 KBbnjmnm
media-widget-100-consecutive-uploads.patch11.65 KBbnjmnm

Comments

bnjmnm created an issue. See original summary.

bnjmnm’s picture

bnjmnm’s picture

Issue summary: View changes
bnjmnm’s picture

phenaproxima’s picture

"It fails only on testbot"...this is a magic phrase that made me summon the sorcerer known as @Mixologic.

@bnjmnm, @oknate and I discussed this issue with him on Slack. TL;DR: the best lead we have, at the moment, points to this being a potential race condition. The major difference between running the tests on localhost with PHPUnit, and running them on testbot, is that testbot runs tests in parallel and PHPUnit doesn't. So, as @Mixologic said:

now, this particular test is definitely exercising some very weird not-like the real world at all [behavior].
essentially 15 people all using the same browser at the same time to upload a lot of the same filename.
and all going through some pachinko machine of webdriver abstractions to do it.
so the first thing I'd check is whether or not it still fails with just 1 concurrency.

I would suggest, as a next step, that this test be run locally with run-tests.sh, which is what runs the tests in parallel. If it fails locally with that, we can be even more sure that our upload woes are caused by a race condition.

phenaproxima’s picture

More info from @Mixologic:

the other things I think to check on is make sure that there isnt any conflict in the filenames that are being uploaded.
or rather that they are all unique and not constantly trying to upload 'test.png' again and again.
Because I think that this whole pipeline can inadvertantly test things like "how does the browser handle renaming files on its own filesystem"

bnjmnm’s picture

Per the suggestions in #5 and #6, this is the 100x media library patch with single concurrency and unique filenames.

With this change, all tests fail at the 45th or 46th iteration on all databases tested (MySql, SQlite, Postgres). The only difference is SQlite and Postgres fail at the step immediately following upload, waiting for the presence of the alternative text field. The MySql test fails while looking for the media remove button -- because the media never got added to the form.

(and probably worth mentioning that although 40+ uploads in a short period of time is highly unlikely to occur on a real site, addressing the failures surfaced by these tests will likely address the random Media Library test fails being worked on in #3055648: Frequent random fail in \Drupal\Tests\media_library\FunctionalJavascript\MediaLibraryTest

xjm’s picture

Priority: Major » Critical

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

oknate’s picture

Reroll of #7

oknate’s picture

StatusFileSize
new2.45 KB
oknate’s picture

Oops, patch failed to attach last time. Here's the patch. It updates the test to use "Save" button and removes an unused variable.

oknate’s picture

oknate’s picture

StatusFileSize
new925 bytes
new12.11 KB

Testing reloading the page between uploads. I'm curious if this will help. Given that this fails sometimes on Sqlite on the first iteration, I'm not sure if this will help. But if helps a little, perhaps it's part of a multifaceted solution.

oknate’s picture

Interesting: reloading the page between iterations doesn't help. So it's probably a back-end issue, not the media library JavaScript. Given that it works under 40 times more consistently, perhaps just breaking up the tests so we never hit more than forty uploads would help.

oknate’s picture

StatusFileSize
new2.18 KB
new12.08 KB

This time, instead of using the same container, I'm getting a new one. Also, I'm using $this->container->get('file_system')->copy instead of copy.

oknate’s picture

Trying longer wait time, replacing 10000 with 30000 to see if it makes any difference.

oknate’s picture

StatusFileSize
new1.66 KB
new12.15 KB

I noticed that $file_system->copy returns a filepath, so using that. Also, I added the timestamp as a prefix in uniqid(). Let's see if returning the actually file path from copy helps.

oknate’s picture

StatusFileSize
new2.18 KB
new12.46 KB
new607.93 KB

Seeing if deleting files makes a difference.

Also, I noticed there are duplicate files, perhaps there are finite limits on how many images can be uploaded on testbot? when you hit 80 uploads, it gives up.
https://www.drupal.org/files/issues/2019-10-31/duplicate-images.png

It uploads them in the files directory, then copies it to files/type-four-dir

oknate’s picture

StatusFileSize
new2.05 KB
new12.21 KB

Weird, it seems to have made a slight difference (Postgres failed on 47 instead of 45). This cleans up the temporary file at the end of each iteration.

bnjmnm’s picture

Adding a different sort of test to help with troubleshooting (thank you for being another set of eyes on this @oknate!)

This is an abbreviated version of \Drupal\Tests\media_library\FunctionalJavascript\MediaLibraryTest::testWidgetUpload, where only the first two uploads are performed. There's also a database check after media is saved to confirm it was written to the db.

In one version, the first uploaded media is removed from the field before the second is uploaded. In the other, no removal takes place. At least in my burner issue, the SQLite errors are more likely to occur when there's a remove between the two uploads (testbot may prove me wrong....).

Either way, for the sake of narrowing things down I wanted to supplement the current failing patch with another example that surfaces the issue in a different way.

oknate’s picture

redacted. I realize now my comment was not valid.

oknate’s picture

StatusFileSize
new2.98 KB
new52.71 KB

Adding a check on the file_managed table to see if it increments. I tested locally with sqlite and it worked up to 49, then I stopped the test. So this should give a little more info about how far along the process it goes before failing before the alt text failure we've been seeing.

oknate’s picture

StatusFileSize
new2.13 KB
new3.16 KB
new53.09 KB

Turning on db log and checking for any messages from file_managed_file_save_upload().

oknate’s picture

StatusFileSize
new748 bytes
new53.09 KB

Dang, had a really dumb error on #24, updating.

The output from this test, where there are no log messages means that it's most likely failing before file_managed_file_save_upload(), or perhaps it's failing in that function where there is no logging.

oknate’s picture

StatusFileSize
new1.84 KB
new14.21 KB

Adding more logging to file_managed_file_save_upload, and a fallback error message if there are no logs.

Update, this tells us it's exiting at the beginning of file_managed_file_save_upload(), here, even when it works correctly, so we don't need to look at that function any more, so next, let's look at what calls it ManagedFile::valueCallback().

This is very interesting, because when I run this locally, it is not exiting at the beginning of file_managed_file_save_upload().

It gets passed this part:

if (empty($all_files[$upload_name])) {
    return FALSE;
  }
oknate’s picture

StatusFileSize
new95.58 KB

Clue:

More on #26, on my local, here's the output of $all_files[$upload_name] right at the beginning of file_managed_file_save_upload

$all_files[$upload_name]

This is very interesting because this is empty and exiting the function on testbot here:

if (empty($all_files[$upload_name])) {
    return FALSE;
  }

But on my local it is not empty. So this is a helpful clue as to what's different on testbot vs local. (Remember it doesn't fail locally.)

There must be an alternate way the images are attached that doesn't use file_managed_file_save_upload.

oknate’s picture

StatusFileSize
new3.47 KB
new15.67 KB

Adding more logging output to ManagedFile::valueCallback to try to figure out what's happening.

I get the same output on my local (in reverse cron order), see ManagedFile::valueCallback (in the patch)

message: fids empty, line 164 in ManagedFile
variables:  a:0:{}
message: $element['#extended'] FALSE
 variables:  a:0:{}
message: Input is FALSE in ManagedFile::valueCallback()
oknate’s picture

StatusFileSize
new6.48 KB
new15.89 KB

Clearing out messages when a run was successful and adding some spacing.

oknate’s picture

StatusFileSize
new7.68 KB
new16.47 KB

forgot execute() on truncate:

-      $database->truncate('watchdog');
+      $this->container->get('database')->truncate('watchdog')->execute();
oknate’s picture

StatusFileSize
new16.19 KB
new1.44 KB
new7.4 KB

Trying $this->resetAll() to see if cache clearing makes any difference. Also, I changed my mind about clearing out previous log messages. I think they're helpful.

Ok, here's another clue:

FileUploadForm::uploadButtonSubmit isn't hit when it fails, but is hit when it succeeds.

oknate’s picture

StatusFileSize
new5.06 KB
new19.22 KB

Adding more logging.

oknate’s picture

StatusFileSize
new1.52 KB
new19.94 KB

Adding a bit more logging. I want to see if updateFormCallback is called on the last iteration.

oknate’s picture

StatusFileSize
new6.19 KB
new19.9 KB

Oops, serialize was blowing up. Removing for now. Although it would be good to get some info about the upload.

Another clue:
::updateFormCallback is not called on the last iteration.

oknate’s picture

StatusFileSize
new657 bytes
new19.86 KB

Removing the 'type' filter on the watchdog messages. Perhaps something else will come up. Hopefully it won't be too much output.

oknate’s picture

StatusFileSize
new5.77 KB
new22.66 KB

Adding more logging around the backtrace leading up to FileUploadForm::uploadButtonSubmit, since we know it's not called on the failed iteration, but that the BE is being hit as it calls ManagedFile::valueCallback.

oknate’s picture

StatusFileSize
new1.55 KB
new22.7 KB

fixing the failure I introduced in the last patch and adding file size output.

oknate’s picture

StatusFileSize
new580 bytes
new22.64 KB
oknate’s picture

StatusFileSize
new1.76 KB
new22.75 KB

adding logging of form_state values near where it's failing.

Update:
At least based on the logging I've added, it seems to fail after FormBuilder calls $this->formSubmitter->doSubmitForm for the "Apply filters" button.

Last iteration before it fails:

$form_state->getValues(): @"name":"","submit":"Apply filters","sort_by":"created","form_build_id":"form-PsYu15H1LhnEfQUfKMQ0g9Krgq7qqNxMYlhEH7BSgCo","form_id":"views_exposed_form","":"Apply filters"
Renderer calling setCurrentRenderContext
FormBuilder calling $this->formSubmitter->doSubmitForm
$form_state->getValues(): @"show_view_elements":true,"submit":"Insert selected","media_library_select_form":["47",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"media_library_select_form_selection":"47","form_build_id":"form-dV02yaBMkIm2MwPE9fLewxc-uNbsGm2UPyHhVAdm6Lg","form_token":"cmd2BIvTIC06ML_tDD9RsLXzCeJstkQ3Zvds1qIzy8w","form_id":"views_form_media_library_widget_type_four","op":"Insert selected"
Renderer calling setCurrentRenderContext
FormBuilder calling $this->formSubmitter->doSubmitForm
$form_state->getValues(): @"field_twin_media":{"media_library_update_widget":"Update widget","field_twin_media-media-library-update":"Update widget"}
Renderer calling setCurrentRenderContext
Renderer calling setCurrentRenderContext
FormBuilder calling $this->formSubmitter->doSubmitForm
$form_state->getValues(): @"field_twin_media":{"selection":[{"preview":{"remove_button":"Remove","target_id":"47","weight":"0"}],"media_library_open_button":"Add media","media_library_selection":"","media_library_update_widget":"Update widget"},"field_twin_media-0-media-library-remove-button":"Remove"}
Renderer calling setCurrentRenderContext

Last failing iteration:

$form_state->getValues(): @"name":"","submit":"Apply filters","sort_by":"created","form_build_id":"form-YDfW8bHcEtdHgki_1N06SZwrg0ytDmkl7JhwBMw49MY","form_id":"views_exposed_form","":"Apply filters"
Renderer calling setCurrentRenderContext
Renderer calling setCurrentRenderContext
Renderer calling setCurrentRenderContext
Renderer calling setCurrentRenderContext
Renderer calling setCurrentRenderContext
Renderer calling setCurrentRenderContext
oknate’s picture

StatusFileSize
new675 bytes
new23.41 KB

testing disabling the "Apply filters" button since it looks like it's submitting around where it's failing.

oknate’s picture

StatusFileSize
new15.27 KB
new23.09 KB

ignore this one, was missing the change I was trying to add.

oknate’s picture

StatusFileSize
new7.49 KB
new30.58 KB

removing the exposed filters to test if that makes a difference.

oknate’s picture

StatusFileSize
new3.05 KB
new25.86 KB

Adding logging info about the file in NegotiationMiddleware::handle

Update:

this seems to indicate that that when it fails it fails very early in the stack, because NegotiationMiddleware::handle isn't hit the second time, like the other iterations.

oknate’s picture

StatusFileSize
new3.91 KB
new25.91 KB
  • Removing logging of 'Renderer calling setCurrentRenderContext' for now
  • adding a few other log messages
  • using temporary file directory.

Update: on my local the temporary file worked, but it doesn't here. So we should remove that change or figure out how to get it to work.

catch’s picture

Title: Random failures building media library form after uploading image. » Random failures building media library form after uploading image (WidgetUpdloadTest)
catch’s picture

Marking #3103492: Random fail in WidgetUploadTest as duplicate.

This is failing very, very often. Should we mark the test as skipped until there's a viable patch here?

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

catch’s picture

Title: Random failures building media library form after uploading image (WidgetUpdloadTest) » [random test failure] Random failures building media library form after uploading image (WidgetUpdloadTest)
phenaproxima’s picture

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

xjm’s picture

Title: [random test failure] Random failures building media library form after uploading image (WidgetUpdloadTest) » [random test failure] Random failures in JavaScript tests following file uploads

Per @bnjmnm, this is now also the cause of many, many random fails in CKEditor 5 tests, e.g.:
https://www.drupal.org/pift-ci-job/2238883

This has more than doubled our random fail rate following beta1.

wim leers’s picture

I was actually monitoring this too, and was pleasantly surprised that we still don't have any random fails on MySQL: https://www.drupal.org/pift-ci-job/2238957. Never any random fails on the contrib project either!

It can’t be a concurrency problem either, because these are FunctionalJavascript tests, and they run with concurrency level 1 both in contrib and core. Aha, core runs these with concurrency 15! So that could be it … but only on PostgreSQL then. Could be some locking/conflict thing?

But … we didn’t have tests against PostgreSQL in the contrib module. So that is likely to be slower somehow? 🤔 The random fail does not seem to be random at all, but ALMOST consistent, on PostgreSQL, with the vast majority of test runs crashing like this:

Testing Drupal\Tests\ckeditor5\FunctionalJavascript\CKEditor5Test
.....E..                                                            8 / 8 (100%)

Time: 2.91 minutes, Memory: 6.00 MB

There was 1 error:

1) Drupal\Tests\ckeditor5\FunctionalJavascript\CKEditor5Test::testEditorFileReferenceIntegration
Behat\Mink\Exception\ElementNotFoundException: Element matching xpath "//img[@src="/subdirectory/sites/simpletest/16481256/files/inline-images/image-test.png" and @loading="lazy" and @width and @height and @data-entity-uuid="718d3b72-2867-490e-9e8c-c49801754718" and @data-entity-type="file"]" not found.

/var/www/html/vendor/behat/mink/src/WebAssert.php:418
/var/www/html/core/tests/Drupal/Tests/WebAssert.php:968
/var/www/html/core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditor5Test.php:390
/var/www/html/vendor/phpunit/phpunit/src/Framework/TestResult.php:703

That is the last line of this chunk of code:

    $assert_session->assertWaitOnAjaxRequest();
    $page->pressButton('Save');

    $uploaded_image = File::load(1);
    $image_url = $this->container->get('file_url_generator')->generateString($uploaded_image->getFileUri());
    $image_uuid = $uploaded_image->uuid();
    $assert_session->elementExists('xpath', sprintf('//img[@src="%s" and @loading="lazy" and @width and @height and @data-entity-uuid="%s" and @data-entity-type="file"]', $image_url, $image_uuid));

… there's not even any JS/AJAX involved there! So let's add some debug output.

bnjmnm’s picture

Issue summary: View changes
longwave’s picture

I downloaded the artifacts from the Postgres run at https://dispatcher.drupalci.org/job/drupal_patches/103942/artifact/jenki...

There are 45 files output with an <img> tag in them; of these 30 look correct (e.g. <img data-entity-uuid="4ee93afa-6380-47c1-89da-603a2915c88c" data-entity-type="file" src="/subdirectory/sites/simpletest/19350594/files/inline-images/image-test.png" alt="&lt;/em&gt; Kittens &amp; llamas are cute" />) but the other 15 are just empty <img /> tags with no attributes.

Example: https://dispatcher.drupalci.org/job/drupal_patches/103942/artifact/jenki...

lauriii’s picture

Title: [random test failure] Random failures in JavaScript tests following file uploads » [random test failure] Random failures building media library form after uploading image (WidgetUpdloadTest)

Opened new issue for #52 since it was likely unrelated. Also reverting the title change.

lauriii’s picture

StatusFileSize
new1.74 KB
wim leers’s picture

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

alexpott’s picture

Drupal\Tests\ckeditor5\FunctionalJavascript\MediaLibraryTest is failing pretty consistently on SQLite - see https://www.drupal.org/pift-ci-job/2268909 - given SQLite is the fastest test environment we have this suggests there's a timing issue in this test.

anybody’s picture

Hi @all here,

I am facing this Media Library Browser race condition issue in UI: #3174361: Media Library modal opens randomly on AJAX requests

TL;DR: Opening / Closing (paragraphs) modals very fast a few times leads to unexpected calls to MediaLibraryWidget::openMediaLibrary() from request parameters that should not exist. So the Media Library Modal is randomly opened on race conditions, if just the Media Library Widget is present on the page (but never clicked!).

There are strange things going on with the #ajax handling and the subsequent requests, when clicking fast, as I documented in the issue. As there are several similarities and both seem to be caused by a race condition, I thought the issues might be related or have the same cause. Perhaps finding one reason also fixes the other problem. Could someone with a deeper understanding of the AJAX / Commands handling in core have a look and give an opinion?

I'm sorry, if I'm wrong, and they're unrelated.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

spokje’s picture

spokje’s picture

StatusFileSize
new1.76 KB
new2.26 KB

1500x is too much in one go, whenever a patch like this hits the 50+ minutes, "wonky" things happen.
Let's see if we can keep it below that in a 1000x patch

spokje’s picture

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

spokje’s picture

Assigned: Unassigned » spokje
StatusFileSize
new2.84 KB

I believe this random test failure doesn't appear anymore.
To prove this, we need about 5000-8000 runs failure-free runs of the suspicious test.

Let's try that here. I use 500 runs in one patch, since any time the repeated runs of this test get's over 45 minutes, things get "wonky" and unreliable. The 500x run should finish within 30-35 minutes.

catch’s picture

The fails are


upal\Core\Installer\Exception\InstallerException: Resolve all issues below to continue the installation. For help configuring your database server, see the installation handbook, or contact your hosting provider.Failed to connect to database. The database engine reports the following message: SQLSTATE[HY000]: General error: 5 database is locked.Does the database file exist?Does web server have permission to write to the database file?Does the web server have permission to write to the directory the database file should be created in?

we can just ignore that IMO, looks solid otherwise.

spokje’s picture

we can just ignore that IMO, looks solid otherwise.

Agreed, this "somehow" happens (randomly) when running single Functional(Javascript)Tests a lot of times.
Seen this happen on a lot of my fix-the-bloody-random-failure-and-run-it-500+-times patches and they are (at the very least) not related to the test that is the SUT.

As far as I'm concerned: This random test failure is gone (for now).

Unsure what should happen with this issue.
I've seen older similiar issues being closed as cannot reproduce. If needed they can be found in the search and reopened (See for example #2980750: [random test failure] Random failure in CommentStatisticsTest)

longwave’s picture

Title: [random test failure] Random failures building media library form after uploading image (WidgetUpdloadTest) » [random test failure] Random failures building media library form after uploading image (WidgetUploadTest)
Status: Active » Closed (cannot reproduce)

Yep, let's close as cannot reproduce, and this can be reopened if it starts appearing again.

Thanks for looking into this.