Closed electrofelix closed 3 years ago
This issue has been marked stale because it has had no activity for 60 days. The Puppet Team is actively prioritizing existing bugs and new features, if this issue is still important to you please comment and we will add this to our backlog to complete. Otherwise, it will be closed in 7 days.
While I'm no longer using puppet, I'd imagine this issue still impacts other users who have to run their code behind a proxy.
This issue has been marked stale because it has had no activity for 60 days. The Puppet Team is actively prioritizing existing bugs and new features, if this issue is still important to you please comment and we will add this to our backlog to complete. Otherwise, it will be closed in 7 days.
Getting occasional failures with proxy connects failing which are transient:
This appears to be related to #42 but the precise errors that should be handled were unknown.
Given that earlier request connections with the same proxy succeeded, this should confirm that there isn't an issue with the proxy settings, they are pointing to a valid proxy, but there has been some transient error.
Looking around the net it appears that 'connection refused' can also occur when a connection buffer is full and subsequent attempts will be rejected until it clears a bit - https://stackoverflow.com/a/2333446/1597808
This suggests it should be possible to configure r10k retry on "connection refused" errors from proxies, provided they have already connected successfully.
The exact error looks to be coming from https://github.com/lostisland/faraday/blob/f08a985bd1dc380ed2d9839f1103318e2fad5f8b/lib/faraday/adapter/httpclient.rb#L54 which is caught and outputted with the error message via: https://github.com/puppetlabs/forge-ruby/blob/a5268161fec1a33c47cd58fcc8e5359b3b8fe31a/lib/puppet_forge/connection/connection_failure.rb#L14
While it's unclear to me where r10k is processing the list of modules to retrieve, but it does seem like that r10k is best placed to be aware of when a proxy has been enabled for a particular module and in turn to track that the connection has previously been successful in order to decide whether it is worth retrying. e.g.
If someone could provide a bit of guidance on where best to perform this type of logic assuming it doesn't require a substantial refactoring in order to capture connection settings being used in order to establish whether the failed connect attempted was using settings (endpoint + proxy) that previously worked and therefore is worth retrying, I might be able to do something to help.