-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Entitlements: More robust frame skipping #118983
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
Conversation
|
Pinging @elastic/es-core-infra (Team:Core/Infra) |
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.
This looks fine, though I find it a little confusing because of naming, and it seems a bit fragile to me. How do our existing entitlement IT tests work if this was incorrect? Can you at least add some comments to the requestingModule and findRequestingModule methods explaining the split and the expected outcome/behavior? Also, is there any anticipated performance hit by removing the constant skip?
libs/entitlement/src/main/java/org/elasticsearch/entitlement/runtime/policy/PolicyManager.java
Outdated
Show resolved
Hide resolved
jdconrad
left a comment
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.
I think this a good idea, but we should take it a bit further to be less lenient.
libs/entitlement/src/main/java/org/elasticsearch/entitlement/runtime/policy/PolicyManager.java
Outdated
Show resolved
Hide resolved
libs/entitlement/src/main/java/org/elasticsearch/entitlement/runtime/policy/PolicyManager.java
Show resolved
Hide resolved
|
For the performance hit: it was already skipping frames in the JDK, and now the entitlement runtime frames have the same overhead as the JDK frames. |
jdconrad
left a comment
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.
LGTM! Thanks for improving this.
rjernst
left a comment
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.
LGTM
...nt/src/main/java/org/elasticsearch/entitlement/initialization/EntitlementInitialization.java
Outdated
Show resolved
Hide resolved
libs/entitlement/src/main/java/org/elasticsearch/entitlement/runtime/policy/PolicyManager.java
Outdated
Show resolved
Hide resolved
* More robust frame skipping * Cosmetic improvements for clarity * Explicit set of runtime classes * Pass entitlements runtime module to PolicyManager ctor * Use the term "entitlements module" and filter instead of dropWhile * [CI] Auto commit changes from spotless --------- Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
💚 Backport successful
|
* More robust frame skipping * Cosmetic improvements for clarity * Explicit set of runtime classes * Pass entitlements runtime module to PolicyManager ctor * Use the term "entitlements module" and filter instead of dropWhile * [CI] Auto commit changes from spotless --------- Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
The existing
requestingModulelogic skips a fixed number of frames, making highly sensitive to refactoring, and also making it impossible to callrequestingModulefrom frames at two different depths.The new logic inspects the frames to skip the runtime frames, and then the JDK frames, regardless of how many there are.
Supersedes #118796 with more to come.