Skip to content

Conversation

gradinac
Copy link
Contributor

@gradinac gradinac commented Jun 14, 2021

Closes #3457

@gradinac gradinac requested a review from zakkak June 14, 2021 12:07
@gradinac
Copy link
Contributor Author

@zakkak Would something like this help with debugging provider/service removal issues?

}

private void traceRemovedProviders() {
if (removedProviders.isEmpty()) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if (removedProviders.isEmpty()) {
if (removedProviders == null || removedProviders.isEmpty()) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice catch! :)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Contributor Author

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

@zakkak
Copy link
Collaborator

zakkak commented Jun 14, 2021

@zakkak Would something like this help with debugging provider/service removal issues?

@gradinac it helps a lot. Thank you!

@gradinac gradinac force-pushed the gradinac/GR-32040-log-removed-providers branch from 0170a60 to 903e446 Compare June 14, 2021 12:44
Comment on lines 347 to 348
removedProviders = new ArrayList<>(providerList.providers());
removedProviders.removeIf(provider -> !shouldRemoveProvider(provider));
Copy link
Collaborator

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:

Suggested change
removedProviders = new ArrayList<>(providerList.providers());
removedProviders.removeIf(provider -> !shouldRemoveProvider(provider));
if (Options.TraceSecurityServices.getValue()) {
removedProviders = new ArrayList<>(providerList.providers());
removedProviders.removeIf(provider -> !shouldRemoveProvider(provider));
}

Copy link
Contributor Author

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

@gradinac gradinac force-pushed the gradinac/GR-32040-log-removed-providers branch from 903e446 to fe3783d Compare June 14, 2021 13:45
@graalvmbot graalvmbot merged commit b5338aa into oracle:master Jun 18, 2021
@zakkak
Copy link
Collaborator

zakkak commented Jun 22, 2021

Thank you @gradinac !

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve -H:+TraceSecurityServices to list Security Services/Providers removed by recent change that filters out "unused" security providers

3 participants