When I run tests in parallel by using vendor/bin/pest --parallel, it fails most about 75% of the tests with SQLSTATE[HY000] [2006] MySQL server has gone away.
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
FAILED Tests\Feature\REDACTED > REDACTED QueryException
SQLSTATE[HY000] [2006] MySQL server has gone away (Connection: mysql, SQL: drop database if exists `REDACTED`)
at vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:65
61▕ * @return \PDO
62▕ */
63▕ protected function createPdoConnection($dsn, $username, $password, $options)
64▕ {
➜ 65▕ return new PDO($dsn, $username, $password, $options);
66▕ }
67▕
68▕ /**
69▕ * Handle an exception that occurred during connect execution.
How to Reproduce
In a repository with multiple tests that access the database, run vendor/bin/pest --parallel.
Sample Repository
No response
Pest Version
2.34.7
PHP Version
8.3.7 and 8.2.19 through Valet
Operation System
macOS
Notes
Running the tests consecutively has never given me any issues.
I am using mysqld 5.7.44 through Homebrew
I have tried configuring /opt/homebrew/etc/my.cnf by adding the following:
What Happened
When I run tests in parallel by using
vendor/bin/pest --parallel
, it fails most about 75% of the tests withSQLSTATE[HY000] [2006] MySQL server has gone away
.How to Reproduce
In a repository with multiple tests that access the database, run
vendor/bin/pest --parallel
.Sample Repository
No response
Pest Version
2.34.7
PHP Version
8.3.7 and 8.2.19 through Valet
Operation System
macOS
Notes
Running the tests consecutively has never given me any issues.
I am using
mysqld
5.7.44 through HomebrewI have tried configuring
/opt/homebrew/etc/my.cnf
by adding the following:These are commonly suggested configurations when encountering this specific error.
I have also tried both using a socket connection and connecting to
127.0.0.1
andlocalhost
.The reason I'm posting this as an issue in this repo is that I think Pest should manage the connection correctly.