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

Failed to bind as java.util.concurrent.ThreadPerTaskExecutor is unsupported. #4826

Closed
loicmathieu opened this issue Mar 4, 2024 · 11 comments
Labels
for: external-project For an external project and not something we can fix

Comments

@loicmathieu
Copy link

Describe the bug
Micrometer ExecutorServiceMetrics class logs a warning Failed to bind as java.util.concurrent.ThreadPerTaskExecutor is unsupported. when runs in Java 21.

Environment

  • Micrometer version: 1.12.2
  • Micrometer registry: prometheus
  • OS: Ubuntu 23.10
  • Java version: 21

Expected behavior
No warning logs should be visible in the console.

@loicmathieu
Copy link
Author

I just noticed there is a second log just after that seems to be also link to Java 21: Failed to bind as java.util.concurrent.Executors$AutoShutdownDelegatedExecutorService is unsupported.

@dozsa
Copy link

dozsa commented Mar 7, 2024

Ran into the same issue. Seems that the Java 21 ThreadPerTaskExecutor class is not supported by ExecutorServiceMetrics. You can see that in its bindTo method. So this will be an enhancement.

@shakuzen
Copy link
Member

Which executor metrics specifically are you interested in with a ThreadPerTaskExecutor?

@shakuzen shakuzen added enhancement A general enhancement and removed waiting-for-triage labels Mar 13, 2024
@loicmathieu
Copy link
Author

@shakuzen no idea, I just want this warning to disappear and Micrometer to work as usual.

@shakuzen
Copy link
Member

What do you mean by work as usual? The log message is making you aware something is trying to monitor an ExecutorService that is not supported. There will be no corresponding metrics but nothing is broken, per se. If you don't want the warning log, don't call ExecutorServiceMetrics.monitor with something not supported. If we didn't log anything in the case of trying to bind to a ThreadPerTaskExecutor, users might be confused why there are no metrics.

Are you configuring this yourself or is some library/framework trying to do this? If the latter, probably that library/framework should be updated to not do this with ThreadPerTaskExecutor until/unless it is supported.

@loicmathieu
Copy link
Author

I'm using Micronaut.
I'll report the message at their side.

@dozsa
Copy link

dozsa commented Mar 13, 2024

By reading the source for both ExecutorServiceMetrics and ThreadPerTaskExecutor I think the only metric it could capture is ThreadPerTaskExecutor.threadCount() which would map to executor.active.

@vad3x
Copy link

vad3x commented Mar 19, 2024

It seems it's been fixed here: micronaut-projects/micronaut-micrometer#679

@loicmathieu
Copy link
Author

OK, let's close it.
Thanks @vad3x

@jonatan-ivanov jonatan-ivanov closed this as not planned Won't fix, can't repro, duplicate, stale Mar 19, 2024
@jonatan-ivanov jonatan-ivanov added for: external-project For an external project and not something we can fix and removed enhancement A general enhancement labels Mar 19, 2024
@angulito

This comment was marked as off-topic.

@shakuzen
Copy link
Member

@angulito that's not really related to this issue. It would have been better to comment on that pull request. I've left a review on it now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: external-project For an external project and not something we can fix
Projects
None yet
Development

No branches or pull requests

6 participants