Skip to content

Keep the pending-acks gauge alive as long as the poller - #57

Merged
thomasdarimont merged 1 commit into
mainfrom
gh-56-ssf-receiver-poller-gauge-nan-issue
Oct 22, 2026
Merged

thomasdarimont merged 1 commit into
mainfrom
gh-56-ssf-receiver-poller-gauge-nan-issue

Conversation

@thomasdarimont

Copy link
Copy Markdown
Collaborator

Micrometer refers to what a gauge reads weakly, and SsfPoller handed it a fresh method reference on every start that nothing else held on to. After a garbage collection the easyssf.receiver.poll.pending-acks gauge read NaN; the JDK 27 job of the CI collected it first. The poller now keeps the supplier in a field, so the gauge lives exactly as long as the poller, and the metrics javadoc states that contract.

The test provokes a collection and proves it happened through a weak reference of its own, as System.gc() is only a hint.

Fixes #56

Micrometer refers to what a gauge reads weakly, and SsfPoller handed it
a fresh method reference on every start that nothing else held on to.
After a garbage collection the easyssf.receiver.poll.pending-acks gauge
read NaN; the JDK 27 job of the CI collected it first. The poller now
keeps the supplier in a field, so the gauge lives exactly as long as
the poller, and the metrics javadoc states that contract.

The test provokes a collection and proves it happened through a weak
reference of its own, as System.gc() is only a hint.

Fixes #56

Signed-off-by: Thomas Darimont <thomas.darimont@googlemail.com>
@thomasdarimont
thomasdarimont merged commit 1fddcae into main Oct 22, 2026
10 checks passed
@thomasdarimont
thomasdarimont deleted the gh-56-ssf-receiver-poller-gauge-nan-issue branch October 22, 2026 08:32
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.

Pending-acks gauge of the poller reads NaN after a garbage collection

1 participant