Skip to content

Conversation

@jan-elastic
Copy link
Contributor

fixes #136907

@jan-elastic jan-elastic added >test Issues or PRs that are addressing/adding tests :ml Machine learning Team:ML Meta label for the ML team auto-backport Automatically create backport pull requests when merged v9.3.0 v9.2.2 v8.19.8 v9.1.8 labels Nov 7, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/ml-core (Team:ML)

meterRegistry,
true,
ONE_SECOND,
2 * ONE_SECOND,
Copy link
Contributor Author

@jan-elastic jan-elastic Nov 7, 2025

Choose a reason for hiding this comment

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

These two settings:

  • timeIntervalSeconds of ONE_SECOND
  • scaleToZeroAfterNoRequestsSeconds of ATOMIC_SECOND

lead to a race condition. Adaptive allocations service checks after 1 second (the timeIntervalSeconds) whether there's been no request for 1 second (the scaleToZeroAfterNoRequestsSeconds).

On Unix-based systems this seems to always pass. Locally on my MacBook the timeWithoutRequestsSeconds is always something like 1.001 seconds, so the model is scaled to zero.

This test is probably failing on Windows builds on x86 hardware, because of a less precise system clock, see:
https://learn.microsoft.com/en-us/windows-hardware/drivers/kernel/high-resolution-timers#controlling-timer-accuracy. Not sure 100% sure, I'm no Windows expert by any means.

Increasing the timeIntervalSeconds to 2 seconds, and then checking whether there's been no request for 1 second, solves the issue. Unfortunately, this add 2 more seconds of unit test time, because the times are set in seconds instead of milliseconds.

@jan-elastic jan-elastic requested a review from davidkyle November 7, 2025 14:14
@jan-elastic jan-elastic merged commit d046d0e into elastic:main Nov 7, 2025
33 of 34 checks passed
jan-elastic added a commit to jan-elastic/elasticsearch that referenced this pull request Nov 7, 2025
jan-elastic added a commit to jan-elastic/elasticsearch that referenced this pull request Nov 7, 2025
@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

Status Branch Result
9.2
8.19 Commit could not be cherrypicked due to conflicts
9.1

You can use sqren/backport to manually backport by running backport --upstream elastic/elasticsearch --pr 137731

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-backport Automatically create backport pull requests when merged backport pending :ml Machine learning Team:ML Meta label for the ML team >test Issues or PRs that are addressing/adding tests v8.19.8 v9.1.8 v9.2.2 v9.3.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CI] AdaptiveAllocationsScalerServiceTests test_scaleDownToZero_whenNoRequests failing

3 participants