Updated: Comment #N
Problem/Motivation
Apparently since #2171683: Remove all Simpletest overrides and rely on native multi-site functionality instead and despite #2193521: Simpletest suffixes are not guaranteed to be unique, we're seeing a new type of random missing table fails.
It looks like this:
[12-Feb-2014 09:58:09 UTC] PHP Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42S02]: Base table or view not found: 1146 Table 'drupaltestbotmysql.simpletest915391semaphore' doesn't exist' in /var/lib/drupaltestbot/sites/default/files/checkout/core/lib/Drupal/Core/Database/Statement.php:61
Stack trace:
#0 /var/lib/drupaltestbot/sites/default/files/checkout/core/lib/Drupal/Core/Database/Statement.php(61): PDOStatement->execute(Array)
#1 /var/lib/drupaltestbot/sites/default/files/checkout/core/lib/Drupal/Core/Database/Connection.php(537): Drupal\Core\Database\Statement->execute(Array, Array)
#2 /var/lib/drupaltestbot/sites/default/files/checkout/core/lib/Drupal/Core/Database/Driver/mysql/Insert.php(34): Drupal\Core\Database\Connection->query('INSERT INTO {se...', Array, Array)
#3 /var/lib/drupaltestbot/sites/default/files/checkout/core/lib/Drupal/Core/Lock/DatabaseLockBackend.php(71): Drupal\Core\Database\Driver\mysql\Insert->execute()
#4 /var/lib/drupaltestbot/sites/default/files/checkout/core/lib/Drupal/Core/Utility/CacheArray.ph in /var/lib/drupaltestbot/sites/default/files/checkout/core/lib/Drupal/Core/Database/Connection.php on line 569
So this is triggered in CacheArray::__destruct(), on the lock() call.
Proposed resolution
Options:
a) Figure out where and what invokes it, reset it early enough in TestBase::restoreEnvironment(), just like drupal_static(), which this apparently isn't, or has additional references to it somewhere. Or maybe __destruct() is sometimes just not called immediately? Then we can't solve it like this.
b) Convert SchemaCache to CacheCollector and remove CacheArray. See #2185015: Remove SchemaCache and CacheArray
c) Add a hack for now that checks if the table exists
Remaining tasks
User interface changes
API changes
Comment | File | Size | Author |
---|---|---|---|
#23 | 2194357.23.patch | 742 bytes | alexpott |
#21 | 2194357.21.test-only.patch | 397 bytes | alexpott |
#21 | 2194357.21.test-only-usleep.patch | 1.11 KB | alexpott |
#21 | 2194357.21.test-only.patch | 397 bytes | alexpott |
#21 | 2194357.21.test-only-usleep.patch | 1.11 KB | alexpott |
Comments
Comment #1
catchThis is a very old issue we've regressed:
From #1563620: All unit tests blow up with a fatal error.
Of the options, I'd probably bump #2185015: Remove SchemaCache and CacheArray to critical and mark this duplicate.
Comment #2
BerdirWondering if we should do c) then though, because this is happen pretty frequent right now.
Comment #3
catchYeah if the other issue is critical that seems fine as a stop-gap.
Comment #4
BerdirOk, let's try if this helps.
Comment #5
catchComment #9
alexpottPatches attached run
Drupal\file\Tests\UsageTest
100 times. One version adds a usleep toTestBase::restoreEnvironment()
Comment #11
alexpott9: 2194357.9.test-only-usleep.patch queued for re-testing.
Comment #12
alexpott9: 2194357.9.test-only.patch queued for re-testing.
Comment #13
alexpott9: 2194357.9.test-only-usleep.patch queued for re-testing.
Comment #14
alexpott9: 2194357.9.test-only.patch queued for re-testing.
Comment #15
alexpott9: 2194357.9.test-only-usleep.patch queued for re-testing.
Comment #16
alexpott9: 2194357.9.test-only.patch queued for re-testing.
Comment #17
alexpottFirst time we submitted #9 tests 5 out of 6 passed. One of the patches without usleep failed [MySQL] 3,400 pass(es), 63 fail(s), and 3 exception(s).
Comment #21
alexpottLet's try 50ms and see what happens
Comment #23
alexpottThe "real" patch.
Comment #25
sunLet's go ahead :-) (No reason to wait 2 more hours, me thinks.)
Comment #26
star-szrTypo fix, don't mind me.
Comment #30
Berdir#21 looks beautiful ;)
Let's get this in ASAP.
Comment #31
alexpottCommitted cec21a6 and pushed to 8.x. Thanks!
Committed as an emergency hotfix even though I worked on this patch due to excessively high amount of random fails.