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

Guard against InaccessibleObjectException when --illegal-access=deny #2447

Closed
shakuzen opened this issue Feb 15, 2021 · 0 comments
Closed

Guard against InaccessibleObjectException when --illegal-access=deny #2447

shakuzen opened this issue Feb 15, 2021 · 0 comments
Assignees
Labels
bug A general bug
Milestone

Comments

@shakuzen
Copy link
Member

See #2317. The default value of the --illegal-access command-line option was changed to deny for Java 16, which brought to our attention that we are not properly guarding for this when we perform illegal reflective access in ExecutorServiceMetrics. Users may be eagerly setting --illegal-access=deny prior to Java 16, so we should guard against this even in maintenance branches that don't claim to support Java 16.

@shakuzen shakuzen added the bug A general bug label Feb 15, 2021
@shakuzen shakuzen added this to the 1.3.17 milestone Feb 15, 2021
@shakuzen shakuzen self-assigned this Feb 15, 2021
shakuzen added a commit to shakuzen/micrometer that referenced this issue Feb 17, 2021
This is an issue with our current implementation for getting at the wrapped ThreadPoolExecutor in some types returned by Executors, when --illegal-access=deny is set. This is the default from Java 16. Without these changes, an uncaught exception is thrown when trying to perform the reflective access on binding ExecutorServiceMetrics with one of the private type ExecutorService in Executors.

With these changes, the exception will be caught and logged. We end up catching all RuntimeExceptions since we cannot use the InaccessibleObjectException type introduced in Java 9, but this is probably fine in this implementation anyways.

Resolves micrometer-metricsgh-2447
@shakuzen shakuzen changed the title Guard against InaccessibleObjectException with --illegal-access=deny Guard against InaccessibleObjectException when --illegal-access=deny Feb 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A general bug
Projects
None yet
Development

No branches or pull requests

1 participant