Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call init() on delegate from TimedScheduler #3876

Merged
merged 2 commits into from
Aug 22, 2024

Conversation

luukveenis
Copy link
Contributor

This fixes an issue where wrapping a BoundedElasticThreadPerTaskScheduler with Micrometer#timedScheduler() causes it to error out immediately.

The TimedScheduler class doesn't currently override the init() method, so it calls the default from the interface, which delegates to start(). This works fine for other scheduler implementations because they still implement start(), but for the virtual thread scheduler, it simply throws an error. When we wrap it in a timed scheduler, it crashes on this error as soon as init() gets called.

@luukveenis luukveenis requested a review from a team as a code owner August 20, 2024 21:19
@pivotal-cla
Copy link

@luukveenis Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

1 similar comment
@pivotal-cla
Copy link

@luukveenis Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

The TimedScheduler class doesn't currently provide an override for the
`init()` method, which means it calls the default implementation on the
interface that delegates to `start()`. This works fine for most
schedulers, since they have a valid implementation of `start()`. However,
the newer BoundedElasticThreadPerTaskScheduler throws an error for
`start()`, so wrapping it in a TimedScheduler causes it to crash
immediately when `init()` gets called.

We should call the wrapped scheduler's `init()` method instead, which
allows users to get metrics for their virtual thread schedulers.
@pivotal-cla
Copy link

@luukveenis Thank you for signing the Contributor License Agreement!

@chemicL
Copy link
Member

chemicL commented Aug 21, 2024

@luukveenis thanks! I took the liberty to add a test to your PR.

@chemicL chemicL added this to the 3.6.10 milestone Aug 21, 2024
@luukveenis
Copy link
Contributor Author

@luukveenis thanks! I took the liberty to add a test to your PR.

Sorry I meant to add one, thank you!

@chemicL chemicL merged commit b732811 into reactor:3.6.x Aug 22, 2024
7 checks passed
chemicL added a commit that referenced this pull request Aug 22, 2024
@chemicL
Copy link
Member

chemicL commented Aug 22, 2024

Thank you for the contribution, @luukveenis 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants