-
Notifications
You must be signed in to change notification settings - Fork 10.7k
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
MySQL connect timeout exceeded should result in a re-connect, but it does not #48688
Comments
Thank you for reporting this issue! As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub. If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team. Thank you! |
This is interesting and simple in original concept, but comes with some caviats. These issues may be ignorable in original draft when getting review on concept, but I think should be thought out (or accounted for) in the final PR. I hope these don't prevent anyone from contributing, but instead just allows someone to be able to tackle it knowing some of the edge cases. Wrinkles that add to the complexity:
Possible solutions:Database TransactionsCurrently Laravel tracks these, so it like the insert counter, we could rely on a counter for that. Database VariablesWe could either add first class support for these, and thus make them more trackable (like a counter). Or we can say that since they are not first class citizens, they should not be used at all. Temp TablesAt least in my experience these are rarely used. Ignoring these could be somewhat safe, but may more mean this behavior needs to be more configurable? Dealing with more than one wrinkle at onceMaybe mark the connection as not reconnnectable once any raw query is issued. |
Closing this issue because it's inactive, already solved, old or not relevant anymore. Feel to open up a new issue if you're still experiencing this. |
Is not solved and is still relevant. |
@GrahamCampbell going to close this one now as it's been open for too long. Seems we haven't gotten other reports about this. If you want, we'd still accept a PR, thanks. |
Laravel Version
10.27.0
PHP Version
8.1.11
Database Driver & Version
MySQL
Description
The DB connector code is meant to retry failed connections, but failing to connect due to a connect timeout is not retried. I have observed this on MySQL, but possibly other drivers suffer the same issue.
Steps To Reproduce
Using the
mysql
driver, set thehost
togoogle.com
. Only one attempt is made to connect to the DB becausetryAgainIfCausedByLostConnection
determines that messageSQLSTATE[HY000] [2002] Operation timed out
should not be re-tried. I think thetryAgainIfCausedByLostConnection
logic is great for re-connecting post-connect, but is not so good for retrying the initial connect. I think we need to add additional message matching specifically for the connector code, only. A timeout should not otherwise be retried, since that could result in double inserts, for example.The text was updated successfully, but these errors were encountered: