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] Retry connection if DNS lookup fails #35790

Merged
merged 1 commit into from Jan 5, 2021

Conversation

deleugpn
Copy link
Contributor

@deleugpn deleugpn commented Jan 5, 2021

Resubmit of #35786


Recently I've been investigating some connection failures:

SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known (SQL: select * from ...)

Upon investigation, I noticed that this happened about 36 times out of 130,396 requests in. Although extremely low (0.02%), it is still quite disruptive to have some requests throwing 500 Internal Server Error and writing database connection logs.
AWS Support has informed that due to transient network issues, it is possible that an extremely small number of connections to RDS or Elasticache might fail and that their engineers are always working on trying to reduce even further these errors. Since it's a rare event of connectivity issues, retrying the connection seem to be a viable option and doing this on my own project seems to be so much harder than using Laravel's built-in system for reconnection.

@taylorotwell taylorotwell merged commit 006180a into laravel:6.x Jan 5, 2021
@deleugpn deleugpn deleted the patch-5 branch January 6, 2021 13:18
@fgilio
Copy link
Contributor

fgilio commented Jan 12, 2021

Thanks @deleugpn! We're going crazy 🎉 about this in the Serverless Laravel Slack group 😂

rihardsgrislis pushed a commit to rihardsgrislis/framework that referenced this pull request Feb 24, 2021
… then this pops out. After seeing laravel#35744, laravel#35790 and others decided to fix this.

PDOException: ```SQLSTATE[08006] [7] could not translate host name "private-xxx-do-user-0.a.db.ondigitalocean.com" to address: Temporary failure in name resolution```
rihardsgrislis pushed a commit to rihardsgrislis/framework that referenced this pull request Feb 24, 2021
… then this pops out. After seeing laravel#35744, laravel#35790 and others decided to fix this.

PDOException: SQLSTATE[08006] [7] could not translate host name "private-xxx-do-user-0.a.db.ondigitalocean.com" to address: Temporary failure in name resolution
rihardsgrislis pushed a commit to rihardsgrislis/framework that referenced this pull request Feb 24, 2021
… then this pops out. After seeing laravel#35744, laravel#35790 and others decided to fix this.

PDOException: SQLSTATE[08006] [7] could not translate host name "private-xxx-do-user-0.a.db.ondigitalocean.com" to address: Temporary failure in name resolution
taylorotwell pushed a commit that referenced this pull request Feb 24, 2021
… then this pops out. After seeing #35744, #35790 and others decided to fix this. (#36373)

PDOException: SQLSTATE[08006] [7] could not translate host name "private-xxx-do-user-0.a.db.ondigitalocean.com" to address: Temporary failure in name resolution
This was referenced Mar 11, 2021
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.

None yet

3 participants