-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
At the moment a channel will expire when either
1 idleTimeoutExpired
2 channel closed by remote end
3 channel TTL expired
But there is one special case making channel not usable. We use AHC to connect to a service behind AWS ALB. When a new deployment happens, the DNS of service will be changed targeting new deployed vesion . But for a period of time(say 1 hour), old version and new version services co-exist. During the hour, the channel of old version service can still be used . But that's not as expected.
Could we update the DefaultChannelPool.IdleChannelDetector to add check
if channel's remoteAddess is not in list of DNS resolve result , we will mark this channel as expired.
Happy to raise a PR for this.
code in DefaultChannelPool.IdleChannelDetector
private List<IdleChannel> expiredChannels(ConcurrentLinkedDeque<IdleChannel> partition, long now) {
// lazy create
List<IdleChannel> idleTimeoutChannels = null;
for (IdleChannel idleChannel : partition) {
boolean isIdleTimeoutExpired = isIdleTimeoutExpired(idleChannel, now);
boolean isRemotelyClosed = !Channels.isChannelActive(idleChannel.channel);
boolean isTtlExpired = isTtlExpired(idleChannel.channel, now);
if (isIdleTimeoutExpired || isRemotelyClosed || isTtlExpired) {
LOGGER.debug("Adding Candidate expired Channel {} isIdleTimeoutExpired={} isRemotelyClosed={} isTtlExpired={}", idleChannel.channel, isIdleTimeoutExpired, isRemotelyClosed, isTtlExpired);
if (idleTimeoutChannels == null)
idleTimeoutChannels = new ArrayList<>(1);
idleTimeoutChannels.add(idleChannel);
}
}
return idleTimeoutChannels != null ? idleTimeoutChannels : Collections.emptyList();
}