[Code red] handle HOSTUNREACH and EADDRNOTAVAIL syscall errors (version 3.5.0) #135
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What?
EHOSTUNREACH
andEADDRNOTAVAIL
syscall errors asActiveUtils::ConnectionError
Why?
Resolves https://github.com/Shopify/shopify/issues/576905 and similar issues
EHOSTUNREACH
is returned when a host is unreachable due to network conditions such as firewall rules.EADDRNOTAVAIL
is returned when the host is address is not valid - this specifically happens in Core when for hosts such aslocalhost
which are not permitted.Although not highly prevalent, it does create noise among our exceptions and these errors are not exceptional. Below are some rough numbers on these errors (query)

We should raise these as
ActiveUtils::ConnectionError
because they're generally they're not transient and retries would be ineffective. This is also helpful for existing users of this library because most are already handlingActiveUtils::ConnectionError
appropriately