-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Deprecate PingableConnection in favor of handling lost connection #4119
Conversation
28caa9d
to
8658105
Compare
8658105
to
1953b2f
Compare
1953b2f
to
0a5bac1
Compare
Hi @morozov
Correct me if I'm wrong, but if I understand this change correctly, the difference is that the connection gets closed properly if the connection is lost. But it doesn't execute the query again, in such a case. So it only ensures that the next query succeeds again. |
Sounds correct.
There's no way to ensure that it's not lost. Even if the query you use to probe the connection succeeds, there's no guarantee that the real query will.
See the above. The solution is to catch the |
@morozov thx for your reply. Makes all sense. |
I catch the exception and immediately retry my SELECT query but get the same exception again. |
@flmommens please file a separate issue and provide all the details of the failure. The basic case is covered with this test: dbal/tests/Doctrine/Tests/DBAL/Functional/Connection/ConnectionLostTest.php Lines 31 to 51 in 0a5bac1
|
@morozov, why don't you check |
I think, I got it. |
Since DBAL 2.11.0 retry and reconnecting lost connections happens automatically, ping() will be removed in DBAL 3, see the PR at doctrine/dbal#4119 Thus this code is dropped, as since 7.0.0 we require a newer DBAL version.
mysql
-based drivers.ConnectionLost
exception if it's reported by the driver. This means the behavior is happening automatically from now on.Statement
on the wrapperConnection
similarly to how it was done with theoci8
driver in Removed the OCI8Connection::getExecuteMode() method #3808. The newConnection::handle*()
internal methods are temporary and will be moved to anExceptionHandler
after refactoring.