From: aaron-congo (@aaron-congo) <noreply+aaron-congo@github.com>
To: aws/aws-advanced-jdbc-wrapper <noreply+aws-aws-advanced-jdbc-wrapper@github.com>
Subject: Re: [aws/aws-advanced-jdbc-wrapper] PR #2237: feat: add efm3 host monitoring plugin with per-connection registration
Date: Wed, 18 Nov 2026 21:49:15 +0000
Message-ID: <gh-aws-aws-advanced-jdbc-wrapper-2237-rc4621327216@github.com> (raw)
In-Reply-To: <gh-aws-aws-advanced-jdbc-wrapper-2237@github.com>
References: <gh-aws-aws-advanced-jdbc-wrapper-2237@github.com>
(on wrapper/src/main/java/software/amazon/jdbc/plugin/efm/v3/HostMonitorV3Impl.java:315)
`consecutiveFailures` is only reset by a successful probe. When probing stops because no call is due any more, the partial count carries over into the next probing episode, which might start hours later.
Example with `failureDetectionCount=3`: a long query passes `failureDetectionTime`, 2 probes fail (a short network blip, or the monitoring connection dropped by an idle timeout), and then the query finishes, so probing stops with `consecutiveFailures=2`. Much later another long query becomes due. Its first probe fails once, the count reaches 3, the host is marked unhealthy, and a healthy query is aborted after a single failed probe.
Resetting the count when there's nothing due keeps "consecutive" scoped to one episode:
```suggestion
if (!this.hostUnhealthy.get() && !this.hasDueSlot(now)) {
// Nothing has been in flight long enough to justify a probe. Scan again shortly; a probe is not needed until the
// grace period of some call has elapsed, so a coarse tick does not delay detection. Earlier failed probes no
// longer form a consecutive run.
this.consecutiveFailures.set(0);
this.sleepNanos(this.scanTickNanos);
return;
}
```
A unit test would help here: two failed probes, no due slot for one iteration, then one failed probe. The host should not be marked unhealthy.