Opened 10 years ago
Closed 9 years ago
#31537 closed defect (bug) (fixed)
Database lock timeout in phpunit (fresh install)
Reported by: | byron.hawkins | Owned by: | |
---|---|---|---|
Milestone: | 4.1.2 | Priority: | normal |
Severity: | normal | Version: | 4.2 |
Component: | Build/Test Tools | Keywords: | fixed-major |
Focuses: | Cc: |
Description
After following the instructions, most of the tests fail with "lock timeout" errors in the database. I tried versions 4.1 (revision 30975), 4.1.1 (revision 31478) and the latest (revision 31602), testing against the included ./src/
directory.
I have MySQL configured to allow 30,000 connection with a timeout of 500 seconds, and my Ubuntu 14.04 server has 16GB RAM completely available for the tests. There is minimal load on the database while the tests are executing, so the problem is caused by some kind of direct conflict on the wptests_options
table. Here is a sample of the errors:
WordPress database error Lock wait timeout exceeded; try restarting transaction for query UPDATE `wptests_options` SET `option_value` = '1' WHERE `option_name` = 'comments_per_page' made by PHPUnit_TextUI_Command::main, PHPUnit_TextUI_Command->run, PHPUnit_TextUI_TestRunner->doRun, PHPUnit_Framework_TestSuite->run, PHPUnit_Framework_TestSuite->run, PHPUnit_Framework_TestCase->run, PHPUnit_Framework_TestResult->run, PHPUnit_Framework_TestCase->runBare, Tests_Comment_GetCommentsPagesCount->tearDown, update_option
If this problem is caused by an unmet configuration dependency, then that requirement needs to be stated plainly on the instruction page for the automated tests. Users should be able to simply download and run the tests, without having to figure out the required configuration.
Change History (13)
#3
@
10 years ago
byron.hawkins - Could you try updating your trunk installation and running the tests again? After [31622] you should find that the database locks have gone away. Thanks.
Thanks for the report. The problem is not unmet dependencies. It's a bug in the tests.
Test classes that have their own
tearDown()
method must runparent::tearDown()
last - or at least after they've done all db-related cleanup. Otherwise they run it outside the scope of the MySQL transaction, which causes lock issues in some cases. I'm not sure why it only comes up in some situations - I'm guessing there is some config that's causing my rig (and most people's rigs) to ignore the problem.