Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[6.x] Add broken pipe exception as lost connection error #36601

Merged

Conversation

mmachatschek
Copy link
Contributor

On Google Cloud SQL instances it may happen that the connection to the DB is lost with horizon.

This occasionally happens when there are no jobs for a few hours but the connection is still alive.

Log

ErrorException: PDO::prepare(): SSL: Broken pipe
#40 /vendor/laravel/framework/src/Illuminate/Database/Connection.php(338): Illuminate\Foundation\Bootstrap\HandleExceptions::handleError
#39 [internal](0): PDO::prepare
#38 /vendor/laravel/framework/src/Illuminate/Database/Connection.php(338): Illuminate\Database\Connection::Illuminate\Database\{closure}
#37 /vendor/laravel/framework/src/Illuminate/Database/Connection.php(671): Illuminate\Database\Connection::runQueryCallback
#36 /vendor/laravel/framework/src/Illuminate/Database/Connection.php(638): Illuminate\Database\Connection::run
#35 /vendor/laravel/framework/src/Illuminate/Database/Connection.php(346): Illuminate\Database\Connection::select
#34 /vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2313): Illuminate\Database\Query\Builder::runSelect
#33 /vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2301): Illuminate\Database\Query\Builder::Illuminate\Database\Query\{closure}
#32 /vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2796): Illuminate\Database\Query\Builder::onceWithColumns
#31 /vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2302): Illuminate\Database\Query\Builder::get
#30 /vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(588): Illuminate\Database\Eloquent\Builder::getModels
#29 /vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(572): Illuminate\Database\Eloquent\Builder::get
#28 /vendor/laravel/framework/src/Illuminate/Database/Concerns/BuildsQueries.php(170): Illuminate\Database\Eloquent\Builder::first
#27 /vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(499): Illuminate\Database\Eloquent\Builder::firstOrFail
#26 /vendor/laravel/framework/src/Illuminate/Queue/SerializesAndRestoresModelIdentifiers.php(102): App\Events\Updated::restoreModel
#25 /vendor/laravel/framework/src/Illuminate/Queue/SerializesAndRestoresModelIdentifiers.php(57): App\Events\Updated::getRestoredPropertyValue
#24 /vendor/laravel/framework/src/Illuminate/Queue/SerializesModels.php(122): App\Events\Updated::__unserialize
#23 [internal](0): unserialize
#22 /vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(95): Illuminate\Queue\CallQueuedHandler::getCommand
#21 /vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(60): Illuminate\Queue\CallQueuedHandler::call
#20 /vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(98): Illuminate\Queue\Jobs\Job::fire
#19 /vendor/laravel/framework/src/Illuminate/Queue/Worker.php(406): Illuminate\Queue\Worker::process
#18 /vendor/laravel/framework/src/Illuminate/Queue/Worker.php(356): Illuminate\Queue\Worker::runJob
#17 /vendor/laravel/framework/src/Illuminate/Queue/Worker.php(158): Illuminate\Queue\Worker::daemon
#16 /vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(116): Illuminate\Queue\Console\WorkCommand::runWorker
#15 /vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(100): Illuminate\Queue\Console\WorkCommand::handle
#14 /vendor/laravel/horizon/src/Console/WorkCommand.php(50): Laravel\Horizon\Console\WorkCommand::handle
#13 /vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}
#12 /vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\Container\Util::unwrapIfClosure
#11 /vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\BoundMethod::callBoundMethod
#10 /vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::call
#9 /vendor/laravel/framework/src/Illuminate/Container/Container.php(610): Illuminate\Container\Container::call
#8 /vendor/laravel/framework/src/Illuminate/Console/Command.php(136): Illuminate\Console\Command::execute
#7 /vendor/symfony/console/Command/Command.php(256): Symfony\Component\Console\Command\Command::run
#6 /vendor/laravel/framework/src/Illuminate/Console/Command.php(121): Illuminate\Console\Command::run
#5 /vendor/symfony/console/Application.php(971): Symfony\Component\Console\Application::doRunCommand
#4 /vendor/symfony/console/Application.php(290): Symfony\Component\Console\Application::doRun
#3 /vendor/symfony/console/Application.php(166): Symfony\Component\Console\Application::run
#2 /vendor/laravel/framework/src/Illuminate/Console/Application.php(92): Illuminate\Console\Application::run
#1 /vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(129): Illuminate\Foundation\Console\Kernel::handle
#0 /artisan(37): null

Illuminate\Database\QueryException: PDO::prepare(): SSL: Broken pipe (SQL: select * from ?????????? limit 1)
#37 /vendor/laravel/framework/src/Illuminate/Database/Connection.php(678): Illuminate\Database\Connection::runQueryCallback
#36 /vendor/laravel/framework/src/Illuminate/Database/Connection.php(638): Illuminate\Database\Connection::run
#35 /vendor/laravel/framework/src/Illuminate/Database/Connection.php(346): Illuminate\Database\Connection::select
#34 /vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2313): Illuminate\Database\Query\Builder::runSelect
#33 /vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2301): Illuminate\Database\Query\Builder::Illuminate\Database\Query\{closure}
#32 /vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2796): Illuminate\Database\Query\Builder::onceWithColumns
#31 /vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2302): Illuminate\Database\Query\Builder::get
#30 /vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(588): Illuminate\Database\Eloquent\Builder::getModels
#29 /vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(572): Illuminate\Database\Eloquent\Builder::get
#28 /vendor/laravel/framework/src/Illuminate/Database/Concerns/BuildsQueries.php(170): Illuminate\Database\Eloquent\Builder::first
#27 /vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(499): Illuminate\Database\Eloquent\Builder::firstOrFail
#26 /vendor/laravel/framework/src/Illuminate/Queue/SerializesAndRestoresModelIdentifiers.php(102): App\Events\Updated::restoreModel
#25 /vendor/laravel/framework/src/Illuminate/Queue/SerializesAndRestoresModelIdentifiers.php(57): App\Events\Updated::getRestoredPropertyValue
#24 /vendor/laravel/framework/src/Illuminate/Queue/SerializesModels.php(122): App\Events\Updated::__unserialize
#23 [internal](0): unserialize
#22 /vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(95): Illuminate\Queue\CallQueuedHandler::getCommand
#21 /vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(60): Illuminate\Queue\CallQueuedHandler::call
#20 /vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(98): Illuminate\Queue\Jobs\Job::fire
#19 /vendor/laravel/framework/src/Illuminate/Queue/Worker.php(406): Illuminate\Queue\Worker::process
#18 /vendor/laravel/framework/src/Illuminate/Queue/Worker.php(356): Illuminate\Queue\Worker::runJob
#17 /vendor/laravel/framework/src/Illuminate/Queue/Worker.php(158): Illuminate\Queue\Worker::daemon
#16 /vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(116): Illuminate\Queue\Console\WorkCommand::runWorker
#15 /vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(100): Illuminate\Queue\Console\WorkCommand::handle
#14 /vendor/laravel/horizon/src/Console/WorkCommand.php(50): Laravel\Horizon\Console\WorkCommand::handle
#13 /vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}
#12 /vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\Container\Util::unwrapIfClosure
#11 /vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\BoundMethod::callBoundMethod
#10 /vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::call
#9 /vendor/laravel/framework/src/Illuminate/Container/Container.php(610): Illuminate\Container\Container::call
#8 /vendor/laravel/framework/src/Illuminate/Console/Command.php(136): Illuminate\Console\Command::execute
#7 /vendor/symfony/console/Command/Command.php(256): Symfony\Component\Console\Command\Command::run
#6 /vendor/laravel/framework/src/Illuminate/Console/Command.php(121): Illuminate\Console\Command::run
#5 /vendor/symfony/console/Application.php(971): Symfony\Component\Console\Application::doRunCommand
#4 /vendor/symfony/console/Application.php(290): Symfony\Component\Console\Application::doRun
#3 /vendor/symfony/console/Application.php(166): Symfony\Component\Console\Application::run
#2 /vendor/laravel/framework/src/Illuminate/Console/Application.php(92): Illuminate\Console\Application::run
#1 /vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(129): Illuminate\Foundation\Console\Kernel::handle
#0 /artisan(37): null

@GrahamCampbell
Copy link
Member

Please send to 6.x.

@mmachatschek mmachatschek changed the base branch from 8.x to 6.x March 15, 2021 13:00
@mmachatschek mmachatschek marked this pull request as draft March 15, 2021 13:00
@mmachatschek mmachatschek force-pushed the add_broken_pipe_lost_connection branch from b6a5d86 to c5b54a3 Compare March 15, 2021 13:10
@mmachatschek mmachatschek changed the title [8.x] Add broken pipe exception as lost connection error [6.x] Add broken pipe exception as lost connection error Mar 15, 2021
@mmachatschek mmachatschek marked this pull request as ready for review March 15, 2021 13:10
@mmachatschek
Copy link
Contributor Author

@GrahamCampbell done

@taylorotwell taylorotwell merged commit a69f15d into laravel:6.x Mar 15, 2021
kodiakhq bot referenced this pull request in WesleyKlop/vote-system Mar 17, 2021
Bumps [laravel/framework](https://github.com/laravel/framework) from 8.32.1 to 8.33.1.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/laravel/framework/releases">laravel/framework's releases</a>.</em></p>
<blockquote>
<h2>v8.33.0</h2>
<h3>Added</h3>
<ul>
<li>Added broken pipe exception as lost connection error (<a href="https://github.com/laravel/framework/pull/36601">#36601</a>)</li>
<li>Added missing option to resource (<a href="https://github.com/laravel/framework/pull/36562">#36562</a>)</li>
<li>Introduce StringEncrypter interface (<a href="https://github.com/laravel/framework/pull/36578">#36578</a>)</li>
</ul>
<h3>Fixed</h3>
<ul>
<li>Fixed returns with Mail &amp; Notification components (<a href="https://github.com/laravel/framework/pull/36559">#36559</a>)</li>
<li>Stack driver fix: respect the defined processors in LogManager (<a href="https://github.com/laravel/framework/pull/36591">#36591</a>)</li>
<li>Require the correct password to rehash it when logging out other devices (<a href="https://github.com/laravel/framework/pull/36608">#36608</a>, <a href="https://github.com/laravel/framework/commit/1e6161250074b8106c1fcf153eeaef7c0bf74c6c">1e61612</a>)</li>
</ul>
<h3>Changed</h3>
<ul>
<li>Allow nullable columns for <code>AsArrayObject/AsCollection</code> casts (<a href="https://github.com/laravel/framework/pull/36526">#36526</a>)</li>
<li>Accept callable class for reportable and renderable in exception handler (<a href="https://github.com/laravel/framework/pull/36551">#36551</a>)</li>
<li>Container - detect circular dependencies (<a href="https://github.com/laravel/framework/commit/dd7274d23a9ee58cc1abdf7107403169a3994b68">dd7274d</a>, <a href="https://github.com/laravel/framework/commit/a712f72ca88f709335576530b31635738abd4c89">a712f72</a>, <a href="https://github.com/laravel/framework/commit/6f9bb4cdd84295cbcf7908cc4b4684f47f38b8cf">6f9bb4c</a>)</li>
<li>Initialize CronExpression class using new keyword (<a href="https://github.com/laravel/framework/pull/36600">#36600</a>)</li>
<li>Use different config key for overriding temporary url host in AwsTemporaryUrl method (<a href="https://github.com/laravel/framework/pull/36612">#36612</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/laravel/framework/blob/8.x/CHANGELOG-8.x.md">laravel/framework's changelog</a>.</em></p>
<blockquote>
<h1>Release Notes for 8.x</h1>
<h2><a href="https://github.com/laravel/framework/compare/v8.33.0...8.x">Unreleased</a></h2>
<h2><a href="https://github.com/laravel/framework/compare/v8.32.1...v8.33.0">v8.33.0 (2021-03-16)</a></h2>
<h3>Added</h3>
<ul>
<li>Added broken pipe exception as lost connection error (<a href="https://github.com/laravel/framework/pull/36601">#36601</a>)</li>
<li>Added missing option to resource (<a href="https://github.com/laravel/framework/pull/36562">#36562</a>)</li>
<li>Introduce StringEncrypter interface (<a href="https://github.com/laravel/framework/pull/36578">#36578</a>)</li>
</ul>
<h3>Fixed</h3>
<ul>
<li>Fixed returns with Mail &amp; Notification components (<a href="https://github.com/laravel/framework/pull/36559">#36559</a>)</li>
<li>Stack driver fix: respect the defined processors in LogManager (<a href="https://github.com/laravel/framework/pull/36591">#36591</a>)</li>
<li>Require the correct password to rehash it when logging out other devices (<a href="https://github.com/laravel/framework/pull/36608">#36608</a>, <a href="https://github.com/laravel/framework/commit/1e6161250074b8106c1fcf153eeaef7c0bf74c6c">1e61612</a>)</li>
</ul>
<h3>Changed</h3>
<ul>
<li>Allow nullable columns for <code>AsArrayObject/AsCollection</code> casts (<a href="https://github.com/laravel/framework/pull/36526">#36526</a>)</li>
<li>Accept callable class for reportable and renderable in exception handler (<a href="https://github.com/laravel/framework/pull/36551">#36551</a>)</li>
<li>Container - detect circular dependencies (<a href="https://github.com/laravel/framework/commit/dd7274d23a9ee58cc1abdf7107403169a3994b68">dd7274d</a>, <a href="https://github.com/laravel/framework/commit/a712f72ca88f709335576530b31635738abd4c89">a712f72</a>, <a href="https://github.com/laravel/framework/commit/6f9bb4cdd84295cbcf7908cc4b4684f47f38b8cf">6f9bb4c</a>)</li>
<li>Initialize CronExpression class using new keyword (<a href="https://github.com/laravel/framework/pull/36600">#36600</a>)</li>
<li>Use different config key for overriding temporary url host in AwsTemporaryUrl method (<a href="https://github.com/laravel/framework/pull/36612">#36612</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/laravel/framework/commit/354c57b8cb457549114074c500944455a288d6cc"><code>354c57b</code></a> patch</li>
<li><a href="https://github.com/laravel/framework/commit/332844e5bde34f8db91aeca4d21cd4e0925d691e"><code>332844e</code></a> revert circular dep</li>
<li><a href="https://github.com/laravel/framework/commit/9f986cef11b959679f530eb24d929b39a2690924"><code>9f986ce</code></a> [8.x] update changelog</li>
<li><a href="https://github.com/laravel/framework/commit/acb117738ddb28ea7fc6a2029cf1d0d06c4b2b57"><code>acb1177</code></a> [8.x] Add DB::resetRecordsModifications (<a href="https://github.com/laravel/framework/issues/36617">#36617</a>)</li>
<li><a href="https://github.com/laravel/framework/commit/03efea900247ed7b9fe0056311ad555033c6e854"><code>03efea9</code></a> fix conflicts</li>
<li><a href="https://github.com/laravel/framework/commit/c25308a00c7bbd38401a6254ab403146da9cfd69"><code>c25308a</code></a> version</li>
<li><a href="https://github.com/laravel/framework/commit/ebfa75fee5acef028a09f52a78a7069b1a09a723"><code>ebfa75f</code></a> Apply fixes from StyleCI (<a href="https://github.com/laravel/framework/issues/36615">#36615</a>)</li>
<li><a href="https://github.com/laravel/framework/commit/eacabc70559e31e985408965f25f74542c56e8b6"><code>eacabc7</code></a> Merge branch 'hotfix/password-rehash' into 8.x</li>
<li><a href="https://github.com/laravel/framework/commit/1e6161250074b8106c1fcf153eeaef7c0bf74c6c"><code>1e61612</code></a> formatting</li>
<li><a href="https://github.com/laravel/framework/commit/d98cf8b5baca2d12341cdc1d75888cfe6fb67260"><code>d98cf8b</code></a> [8.x] Use different config key for overriding temporary url host in AwsTempor...</li>
<li>Additional commits viewable in <a href="https://github.com/laravel/framework/compare/v8.32.1...v8.33.1">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=laravel/framework&package-manager=composer&previous-version=8.32.1&new-version=8.33.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>
@paingheinthu
Copy link

Why only fix for the SSL issue. When the add Broken pipe string will cover for all of broken pipe issue as PDO prepare broken pipe issue

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.

4 participants