[random test failure] Random failures building media library form after uploading image (WidgetUploadTest)

Created on 8 July 2019, over 5 years ago
Updated 26 June 2023, over 1 year ago

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

🐛 Bug report
Status

Closed: cannot reproduce

Version

11.0 🔥

Component
Media 

Last updated about 2 hours ago

Created by

🇺🇸United States bnjmnm Ann Arbor, MI

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024