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] Fix sqlsrv reuses broken connection #30362

Merged
merged 1 commit into from
Oct 21, 2019
Merged

[6.x] Fix sqlsrv reuses broken connection #30362

merged 1 commit into from
Oct 21, 2019

Conversation

Namoshek
Copy link
Contributor

Starting with Laravel 6.x, once in a while one of my queue jobs throws an exception:

SQLSTATE[08S01]: [Microsoft][ODBC Driver 17 for SQL Server]The connection is no longer usable because the server response for a previously executed statement was incorrectly formatted.

As can be seen in the error message, I'm using the SQL Server driver. Unfortunately, I couldn't locate the exact issue so far. It only occured within the queue workers until now, not within the application itself. No very rare jobs are executed, it happens within very regularly executed jobs (i.e. it's unlikely the code of the jobs is the issue).

In general, it doesn't botter me too much as it only happens once a week so far with an average job count of 50k per week. The problem is that the queue workers simply escalate the exception of the job and then reuse the broken connection. To solve this, the PR attempts to force a reconnect if the exceptions contains the mentioned error message. This seems a very fitting strategy as the error explicitely says the connection is no longer usable.

The error itself seems to be very rare as there are next to no reports even outside the Laravel community.

@taylorotwell taylorotwell merged commit ce9eadc into laravel:6.x Oct 21, 2019
@GrahamCampbell GrahamCampbell changed the title Fix: sqlsrv reuses broken connection [6.x] Fix sqlsrv reuses broken connection Oct 21, 2019
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.

3 participants