Skip to content

Conversation

kanidjar
Copy link
Contributor

@kanidjar kanidjar commented Nov 15, 2020

MySQL persistent connections:

  • PHP-FPM 7.4
  • MySQL 8.0 (SSL)

Due to short network unavailabilities, we sometimes lose connection and a reconnection should be attempted.

SQLSTATE[HY000] [2002] Connection timed out

[2020-11-15 11:00:19] production.ERROR: SQLSTATE[HY000] [2002] Connection timed out (SQL: select ...))) {"exception":"[object] (Illuminate\\Database\\QueryException(code: 2002): SQLSTATE[HY000] [2002] Connection timed out (SQL: select ...))) at /var/www/html/vendor/illuminate/database/Connection.php:671)
[stacktrace]
#0 /var/www/html/vendor/illuminate/database/Connection.php(631): Illuminate\\Database\\Connection->runQueryCallback('select count(*)...', Array, Object(Closure))
#1 /var/www/html/vendor/illuminate/database/Connection.php(339): Illuminate\\Database\\Connection->run('select count(*)...', Array, Object(Closure))
#2 /var/www/html/vendor/illuminate/database/Query/Builder.php(2303): Illuminate\\Database\\Connection->select('select count(*)...', Array, true)
#3 /var/www/html/vendor/illuminate/database/Query/Builder.php(2291): Illuminate\\Database\\Query\\Builder->runSelect()
#4 /var/www/html/vendor/illuminate/database/Query/Builder.php(2786): Illuminate\\Database\\Query\\Builder->Illuminate\\Database\\Query\\{closure}()
#5 /var/www/html/vendor/illuminate/database/Query/Builder.php(2292): Illuminate\\Database\\Query\\Builder->onceWithColumns(Array, Object(Closure))
#6 /var/www/html/vendor/illuminate/database/Query/Builder.php(2713): Illuminate\\Database\\Query\\Builder->get(Array)
#7 /var/www/html/vendor/illuminate/database/Query/Builder.php(2641): Illuminate\\Database\\Query\\Builder->aggregate('count', Array)
#8 /var/www/html/vendor/illuminate/database/Eloquent/Builder.php(1508): Illuminate\\Database\\Query\\Builder->count()
#9 /var/www/html/vendor/illuminate/support/Traits/ForwardsCalls.php(23): Illuminate\\Database\\Eloquent\\Builder->__call('count', Array)
#10 /var/www/html/vendor/illuminate/database/Eloquent/Model.php(1757): Illuminate\\Database\\Eloquent\\Model->forwardCallTo(Object(Illuminate\\Database\\Eloquent\\Builder), 'count', Array)
#11 /var/www/html/vendor/illuminate/database/Eloquent/Model.php(1769): Illuminate\\Database\\Eloquent\\Model->__call('count', Array)

SSL: Connection timed out

[2020-11-12 07:20:23] production.ERROR: PDO::__construct(): SSL: Connection timed out (SQL: select * ...) {"exception":"[object] (Illuminate\\Database\\QueryException(code: 0): PDO::__construct(): SSL: Connection timed out (SQL: select ...) at /var/www/html/vendor/illuminate/database/Connection.php:671)
[stacktrace]
#0 /var/www/html/vendor/illuminate/database/Connection.php(631): Illuminate\\Database\\Connection->runQueryCallback('select * from `...', Array, Object(Closure))
#1 /var/www/html/vendor/illuminate/database/Connection.php(339): Illuminate\\Database\\Connection->run('select * from `...', Array, Object(Closure))
#2 /var/www/html/vendor/illuminate/database/Query/Builder.php(2303): Illuminate\\Database\\Connection->select('select * from `...', Array, true)
#3 /var/www/html/vendor/illuminate/database/Query/Builder.php(2291): Illuminate\\Database\\Query\\Builder->runSelect()
#4 /var/www/html/vendor/illuminate/database/Query/Builder.php(2786): Illuminate\\Database\\Query\\Builder->Illuminate\\Database\\Query\\{closure}()
#5 /var/www/html/vendor/illuminate/database/Query/Builder.php(2292): Illuminate\\Database\\Query\\Builder->onceWithColumns(Array, Object(Closure))
#6 /var/www/html/vendor/illuminate/database/Eloquent/Builder.php(549): Illuminate\\Database\\Query\\Builder->get(Array)
#7 /var/www/html/vendor/illuminate/database/Eloquent/Builder.php(533): Illuminate\\Database\\Eloquent\\Builder->getModels(Array)
#8 /var/www/html/vendor/illuminate/database/Concerns/BuildsQueries.php(147): Illuminate\\Database\\Eloquent\\Builder->get(Array)
````

@kanidjar kanidjar changed the title [Mysql] Add lost connection messages for persistent connections [8.x] Add lost connection messages for MySQL persistent connections Nov 15, 2020
@taylorotwell taylorotwell merged commit 9d9533f into laravel:8.x Nov 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants