mercredi 18 décembre 2019

PHPUnit - "Lock wait timeout exceeded; try restarting transaction" error when running tests in bulk

Consider quite big monolythic dokerized application based on Laravel 5.1. When trying to run some tests in bulk we sometimes get following error:

Illuminate\Database\QueryException : SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction

The strange thing is that when I restart the exact test that failed it runs smoothly.

My observations:

  • The error only occurs while running tests in bulk, i.e. by calling ./vendor/bin/phpunit or in IDE. When I run single test or single test class everything works ok.
  • The tests are generally slow for this application. Running ca. 700 tests can last up to 30 minutes.
  • There is no particullar type of tests that fails. There is no general rule to pinpoint what kind of tests cause this problem.

Stack:

  • Laravel 5.1
  • Docker
  • Mysql
  • PHP 7.0
  • PHPUnit 5.7


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire