-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Trace removed security providers #3473
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
Trace removed security providers #3473
Conversation
@zakkak Would something like this help with debugging provider/service removal issues? |
} | ||
|
||
private void traceRemovedProviders() { | ||
if (removedProviders.isEmpty()) { |
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.
if (removedProviders.isEmpty()) { | |
if (removedProviders == null || removedProviders.isEmpty()) { |
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.
Nice catch! :)
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.
Well, it was the CI https://github.com/oracle/graal/pull/3473/checks?check_run_id=2819581300#step:9:788 not me :)
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.
Ah, I haven't run the gates on this internally yet, didn't check these :)
The reason a NPE could happen here - when security isn't used, analysis wont see the Providers.providerList
field. This means the field value recomputer will never run and thus never clear any providers, resulting in a NPE when we access the removedProviders
list
0170a60
to
903e446
Compare
removedProviders = new ArrayList<>(providerList.providers()); | ||
removedProviders.removeIf(provider -> !shouldRemoveProvider(provider)); |
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.
Maybe it would be worth guarding this like this:
removedProviders = new ArrayList<>(providerList.providers()); | |
removedProviders.removeIf(provider -> !shouldRemoveProvider(provider)); | |
if (Options.TraceSecurityServices.getValue()) { | |
removedProviders = new ArrayList<>(providerList.providers()); | |
removedProviders.removeIf(provider -> !shouldRemoveProvider(provider)); | |
} |
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.
While I've initially done this without a guard for consistency with other tracing, I agree with you - it may be better to only compute this list only when needed to avoid overhead during non-debugging builds
903e446
to
fe3783d
Compare
Thank you @gradinac ! |
Closes #3457