GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Reduce flakiness of StatsdMeterRegistryPublishTest by shakuzen · Pull Request #7053 · micrometer-metrics/micrometer

Conversation

@shakuzen

@shakuzen shakuzen commented Jan 6, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

It's not clear why this await behavior was not applied in the case of UDP protocol, but removing the conditional that excludes that seems to fix flakiness of this test.

Upgrading the version of Netty has resolved the underlying flakiness seen in the test and at least from running it 15 times or so locally and a few times on the CI it appears stable.

Find an available port instead of using a fixed port that might not be available.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@shakuzen shakuzen added type: task A general task registry: statsd A StatsD Registry related issue labels Jan 6, 2026
@shakuzen shakuzen added this to the 1.15.8 milestone Jan 6, 2026
jonatan-ivanov
jonatan-ivanov approved these changes Jan 6, 2026
View reviewed changes
@jonatan-ivanov

jonatan-ivanov commented Jan 6, 2026

Copy link
Copy Markdown
Member

It looks completely reasonable to me too but the build on CI seems to have a bad time.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

jonatan-ivanov
jonatan-ivanov reviewed Jan 7, 2026
View reviewed changes
Comment thread ...meter-registry-statsd/src/test/java/io/micrometer/statsd/StatsdMeterRegistryPublishTest.java Outdated
if (protocol == StatsdProtocol.TCP || protocol == StatsdProtocol.UDS_DATAGRAM) {
await().until(() -> meterRegistry.statsdConnection.get() != firstClient);
}
await().until(() -> meterRegistry.statsdConnection.get() != firstClient);

@jonatan-ivanov jonatan-ivanov Jan 7, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we can check the OS/protocol combinations and do this conditionally or maybe we can say that sometimes the client will not be replaced:

Suggested change
await().until(() -> meterRegistry.statsdConnection.get() != firstClient);
try {
await().until(() -> meterRegistry.statsdConnection.get() != firstClient);
}
catch (ConditionTimeoutException ex) {
// Intentionally ignored: in some cases the client gets replaced
// and in some cases it does not (os and protocol dependent)
// Hope Awaitility will have support for this use-case:
// https://github.com/awaitility/awaitility/issues/48
}

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread ...meter-registry-statsd/src/test/java/io/micrometer/statsd/StatsdMeterRegistryPublishTest.java

CountDownLatch server2Latch = new CountDownLatch(3);
server = startServer(protocol, port, server2Latch);
if (protocol == StatsdProtocol.TCP || protocol == StatsdProtocol.UDS_DATAGRAM) {

@jonatan-ivanov jonatan-ivanov Jan 7, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we change this too?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@shakuzen shakuzen Feb 9, 2026

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I reverted the previous changes to the other conditional. I think this is right. The client is not replaced for UDP because of the following code and Violeta's fix in Netty to consistently throw PortUnreachableException with UDP on all platforms.

micrometer/implementations/micrometer-registry-statsd/src/main/java/io/micrometer/statsd/StatsdMeterRegistry.java

Line 254 in bcbf4fe

.retryWhen(Retry.indefinitely().filter(throwable -> throwable instanceof PortUnreachableException)))

@violetagg let me know if I'm mistaken.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

violetagg reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@jonatan-ivanov jonatan-ivanov modified the milestones: 1.15.8, 1.15.x Jan 10, 2026
@shakuzen shakuzen added the blocked An issue that's blocked on an external project change label Jan 15, 2026
@shakuzen

shakuzen commented Jan 15, 2026

Copy link
Copy Markdown
Member Author

Let's wait for netty/netty#16131 which should hopefully make this more uniform across platforms.

jonatan-ivanov reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@shakuzen shakuzen removed the blocked An issue that's blocked on an external project change label Feb 9, 2026
@shakuzen
Improve flakiness of resumeSendingMetrics_whenServerIntermittentlyFails
e4db16b
It's not clear why this await behavior was not applied in the case of UDP protocol, but removing the conditional that excludes that seems to fix flakiness of this test.
@shakuzen
shakuzen force-pushed the flaky-statsd-publish branch from bc31fdd to e4db16b Compare February 9, 2026 03:26
@shakuzen
Update tests for fixed netty behavior
320cd14
shakuzen
shakuzen commented Feb 9, 2026
View reviewed changes
Comment thread ...meter-registry-statsd/src/test/java/io/micrometer/statsd/StatsdMeterRegistryPublishTest.java

CountDownLatch serverLatch = new CountDownLatch(1);
DisposableChannel server = startServer(StatsdProtocol.UDP, config.port(), serverLatch);
DisposableChannel server = startServer(StatsdProtocol.UDP, 0, serverLatch);

@shakuzen shakuzen Feb 9, 2026

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why we were using a fixed port before but it doesn't seem important to the test so I updated this to use a random port which avoids port conflicts (especially when running tests locally).

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@shakuzen
Add back TCP as it sometimes fails otherwise
402f814
@shakuzen shakuzen changed the title Improve flakiness of resumeSendingMetrics_whenServerIntermittentlyFails Improve flakiness of StatsdMeterRegistryPublishTest Feb 9, 2026
@shakuzen

shakuzen commented Feb 9, 2026

Copy link
Copy Markdown
Member Author

I've rebased to pick up the Netty upgrade including the changes from the linked pull request. I reverted the change to the conditional and now things pass (seemingly) consistently locally and on CI.

I reworked the pull request to update some places we were using a fixed port instead of getting an available port, which caused some failures running locally.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@shakuzen shakuzen modified the milestones: 1.15.x, 1.15.9 Feb 9, 2026
@shakuzen
shakuzen merged commit cd83609 into micrometer-metrics:1.15.x Feb 9, 2026
3 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@shakuzen
shakuzen deleted the flaky-statsd-publish branch February 9, 2026 05:48
@shakuzen shakuzen changed the title Improve flakiness of StatsdMeterRegistryPublishTest Reduce flakiness of StatsdMeterRegistryPublishTest Feb 9, 2026
@jonatan-ivanov jonatan-ivanov mentioned this pull request May 2, 2026
Add capability to ignore condition timeout awaitility/awaitility#299
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@jonatan-ivanov jonatan-ivanov jonatan-ivanov approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

registry: statsd A StatsD Registry related issue type: task A general task

Projects

None yet

Milestone

1.15.9

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@shakuzen @jonatan-ivanov
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.