Deprecate PingableConnection in favor of handling lost connection#4119
Deprecate PingableConnection in favor of handling lost connection#4119morozov merged 3 commits intodoctrine:2.11.xfrom
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: |
|
@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.ConnectionLostexception if it's reported by the driver. This means the behavior is happening automatically from now on.Statementon the wrapperConnectionsimilarly to how it was done with theoci8driver in Removed the OCI8Connection::getExecuteMode() method #3808. The newConnection::handle*()internal methods are temporary and will be moved to anExceptionHandlerafter refactoring.