-
-
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
fix MySQL build problems with ConnectionException detection #3656
Conversation
Not sure how the fix addresses the issue. It masks the authentication method issue behind the same exception class as is expected as a result of login failure. |
The test that fails every time tries to connect to a bogus hostname, and makes sure that a ConnectionException happens (see the sample trace below). Perfectly reasonable, except that the code does not trap all possible MySQL connection error states. Specifically the MySQL client code will seemingly for no good reason return a 2006 or a 2054 error some times even if trying to connect to a bogus hostname. 2006 - The MySQL server has gone away This can seem to happen randomly trying to connect to a bogus hostname. This can happen in mid request also, which wouldn't be a ConnectionException, but how to distinguish 2006 during a Connection from 2006 during a regular request? Hence the subclassing. 2054 - The server requested authentication method unknown to the client This is also strange because there's no MySQL host to connect to, yet the driver apparently returns a 2054 error sometimes (as you can see from the tests referenced above). NOTE: this is a different case then the MySQL 8.0 connection issue when the default_authentication method isn't properly set (which was already earlier fixed in the docker command). This new occurrence happens when there isn't even a MySQL server to connect to. 2054 is a new previously uncaught error number in the code base, but only seems to happen on Connect, hence it seems safe to classify both cases as a ConnectionException. This case does not require the subclass like the other does. Sample trace (PDO version):
|
As far as I understand from the error message:
The test is trying to connect to a valid server as a non-existing user and get an error like 1045 (Access denied for user 'not_existing') which is later expected to be converted to a |
Unless it is clear why MySQL 8 doesn't respect the |
On second review, yes, you are correct, all the failures I provided are cases of trying to connect with a user that is non_existing (as that's what's passed in from the list of getConnectionParams()). I think breaking this apart into two different PRs (one for each error number) might make the conversation easier, as I would plead the case still that perhaps 2054 should be classified as a ConnectionException, and 2006 sometimes. Otherwise marking the test as invalid for MySQL 8.0 might be the other possible order of business as you alluded to. |
It looks like a MySQL bug to me. I can reproduce it as follows:
|
Would you consider 2054 to always be classified as a DriverException then? As that’s what the fall through is (for example say you didn’t set the authentication method correctly). |
Aren't all exceptions produced by |
Related: #3662 |
Summary
Over the past few weeks MySQL builds have been randomly failing due to the following sorts of errors (happened with both MySQLi and PDO):
This is happening because the test is expecting a ConnectionException, but instead a DriverConnection is incorrectly happening.
MySQLi driver flaky failed builds:
https://travis-ci.org/doctrine/dbal/jobs/565778380
https://travis-ci.org/doctrine/dbal/jobs/569139933
https://travis-ci.org/doctrine/dbal/jobs/569146693
MySQL PDO driver flaky failed builds:
https://travis-ci.org/doctrine/dbal/jobs/569146680
https://travis-ci.org/doctrine/dbal/jobs/569146690