Problem/Motivation
The FunctionalJavaScript
tests for the Media module frequently fail on SQLite with:
SQLSTATE[HY000]: General error: 5 database is locked
This seems to occur primarily in three tests
Drupal\Tests\ckeditor5\FunctionalJavascript\MediaTest::testErrorMessages()
Drupal\Tests\media\FunctionalJavascript\MediaStandardProfileTest::testMediaSources()
Drupal\Tests\media\FunctionalJavascript\CKEditorIntegrationTest::testErrorMessages()<
There are records of such fails at least as far back as January, but they went from being a 1% fail rate to a 50% or more fail rate when the Drupal test environments were updated at the beginning of March for the Node 16 and Chromedriver updates.
It has also been shown that these failures occur even if the Media JavaScript test group is run by itself (without other tests), and that reducing concurrency to 1 is not sufficient to solve the problem. (See #3273599: [testing] Try reducing concurrency of JS tests to see if that would fix SQLite.)
Proposed resolution
Skip these three test methods on SQLite until a fix is found.See #15.- Figure out why this is happening and make the tests work consistently with SQLite.
Remaining tasks
- Look into why these test fail.
- Unskip them with a fix.
- Verify that the DB locking woes are gone on SQLite.
- Reviews / refinements.
- RTBC
User interface changes
N/A
API changes
TBD
Data model changes
? Maybe depending on the issue.
Release notes snippet
TBD
Comment | File | Size | Author |
---|---|---|---|
#36 | 3273626-36.patch | 7.31 KB | kim.pepper |
Issue fork drupal-3273626
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
xjmComment #4
xjmComment #6
xjmThanks @Spokje!
We don't need multiple runs agains multiple databases, just SQLite databases.
Comment #7
xjmThe
use
statements made me realize we're actually doing the wrong thing -- we don't need to do a version compare or the use statements; we want to skip it regardless of why on SQLite. Should have read the snippet I copied more closely.Comment #8
xjmHmm, both databases have the same # of passes for the tests, so something's still not right. Going to debug this locally.
Comment #9
xjmThe three fails are actual existing random failures, not the database dying.
I also confirmed locally that the tests are actually skipped on SQLite now by running one of the affected tests.
I think this is ready.
Comment #11
dwwThe test results are indeed improved, as expected. I closely reviewed the MR code. Everything looks good. Agreed with the latest commits to skip these tests on SQLite regardless of version. Makes the code easier to read, and seems safer given the intention/scope of this issue.
It seems slightly weird to use this same issue nid for both marking these skipped, and for the @todo target for getting them working again. I'd have assumed those should be separate issues for scope management. But since @xjm did it this way in the first place, and they're the ultimate arbitrator of scope, I defer. 😉
The MR claimed it was blocked, and needed a rebase. I just did that, but since I didn't change any code, I still feel ok RTBC'ing this. At least for phase 1, this is ready.
Thanks!
-Derek
Comment #12
dwwLots of unrelated layout_builder fails. 😢 Requeued.
Comment #15
larowlanMerged the MR to 9.4 and 10.0, technically we should have a separate URL for the todo, as well as comply with the todo format, but because we're talking about stuff that is disrupting actual work, I've committed this without those changes.
Re-purposing this issue to restore the tests and resolve the underlying issue.
Dropping the priority accordingly.
Comment #16
dwwSweet, thanks! Updating summary accordingly.
Comment #17
SpokjeOver in #3241653: Occassional test failures with SQLite: SQLSTATE[HY000]: General error: 5 database is locked the maintainers of FarmOS seem to have some success battling the same problem by running SQLite3 tests in sequence instead of in parallel.
Note: They run their tests on GitHub
I _think_ #3273599: [testing] Try reducing concurrency of JS tests to see if that would fix SQLite where @xjm ran the tests with no concurrency is (slightly) different from running tests in sequence?
Anyway: Just clutching at straws.
Comment #20
Taran2Lhm, interesting ... testing this idea: #1120020-96: SQLite database locking errors cause fatal errors
Comment #21
nod_This seemed to help https://www.drupal.org/project/drupal/issues/2855596#comment-14472477
Comment #22
Taran2LOkay, seems like solution with a timeout does not work ... or am I applying it incorrectly?
@_nod solution from other issue looks much better
Comment #23
nod_This seem to fix the
testMediaSources
failures.Comment #24
nod_added a comment as to why it's necessary to wait.
Comment #25
nod_adding a little delay before the node save happens seems to work for the remaining failures in the testErrorMessages: https://www.drupal.org/project/drupal/issues/2855596#comment-14473027
Comment #27
nod_Seems like it does the trick, 50x run here #2855596-38: [ignore] nod_ test isssue
Comment #28
nod_Failures are unrelated to the tests in question it seems
Comment #29
xjmOne of them is extremely rare, so I am going to re-queue.
Comment #31
andypostComment #32
quietone CreditAttribution: quietone at PreviousNext commentedThis is just a reroll. Patch also applies to 10.0.x and 10.1.x.
Comment #33
SpokjeTo me adding a
sleep
feels like working around the problem.If this needed, can we at least make that sleep only happen when we're actually using SQLite, now we're "punishing" everyone.
Comment #34
rakesh.regarAdded check for SQLite
Comment #36
kim.pepperRe-roll of #34