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

Fix for JarHell Bootstrap Check can yield false positives #76217

Merged
merged 3 commits into from
Aug 10, 2021

Conversation

BalasubramanyamEvani
Copy link
Contributor

Possible fix for Issue #75701 | JarHell Bootstrap Check can yield false positives |

Changes made:

  1. Added separate checks for IOException and URISyntaxException which can be thrown from JarHell.checkJarHell() if Jar file is missing or not properly read
  2. Added a unit test that checks whether the io error message gets thrown or not from checkBundleJarHell

@elasticsearchmachine elasticsearchmachine added external-contributor Pull request authored by a developer outside the Elasticsearch team v8.0.0 labels Aug 7, 2021
@BalasubramanyamEvani BalasubramanyamEvani changed the title Fix for JarHell Bootstrap Check can yield false positives #76125 Fix for JarHell Bootstrap Check can yield false positives Aug 7, 2021
throw new IllegalStateException("failed to load plugin " + bundle.plugin.getName() + " due to io error, caused when checking for Jar Hell", ioe);
} catch (final URISyntaxException urie) {
throw new IllegalStateException("failed to load plugin " + bundle.plugin.getName() + " due to malformed uri, caused when checking for Jar Hell", urie);
} catch (final Exception e) {
Copy link
Member

Choose a reason for hiding this comment

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

I think the original problem could still occur for another unknown exception. Instead of specializing other exception types, let’s specialize the only one we throw for jar hell, IllegalStateException. Then the general exception can catch all the others with a different message like “failed to load plugin foo while checking for jar hell”.

Copy link
Contributor Author

@BalasubramanyamEvani BalasubramanyamEvani Aug 8, 2021

Choose a reason for hiding this comment

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

Yes, it makes sense. I have made the changes to check only for IllegalStateException that gets specifically thrown, the general exception catches all the others

@rjernst rjernst self-assigned this Aug 9, 2021
@rjernst
Copy link
Member

rjernst commented Aug 9, 2021

@elasticmachine ok to test

@rjernst rjernst added v7.15.0 auto-backport Automatically create backport pull requests when merged labels Aug 10, 2021
Copy link
Member

@rjernst rjernst left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution @BalasubramanyamEvani. LGTM

@rjernst rjernst merged commit d6a229b into elastic:master Aug 10, 2021
elasticsearchmachine pushed a commit to elasticsearchmachine/elasticsearch that referenced this pull request Aug 10, 2021
When checking for jarhell while loading plugins, exceptions other than jarhell can occur. The wrapped exception message in these cases refers to jarhell failing, but in actuality it was eg a filesystem error. This commit separates the two cases, jarhell failure and other failure.
@elasticsearchmachine
Copy link
Collaborator

💚 Backport successful

Status Branch Result
7.x

rjernst pushed a commit that referenced this pull request Aug 10, 2021
When checking for jarhell while loading plugins, exceptions other than jarhell can occur. The wrapped exception message in these cases refers to jarhell failing, but in actuality it was eg a filesystem error. This commit separates the two cases, jarhell failure and other failure.

Co-authored-by: E Bala <balasubramanyam.evani@gmail.com>
@joegallo joegallo added the :Core/Infra/Core Core issues without another label label Sep 22, 2021
@elasticmachine elasticmachine added the Team:Core/Infra Meta label for core/infra team label Sep 22, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

@joegallo joegallo added the >bug label Sep 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Automatically create backport pull requests when merged >bug :Core/Infra/Core Core issues without another label external-contributor Pull request authored by a developer outside the Elasticsearch team Team:Core/Infra Meta label for core/infra team v7.15.0 v8.0.0-alpha2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants