Create equivalents of JSM's AccessController in the java agent
Description
The classes in this PR were on a former iteration of https://github.com/opensearch-project/OpenSearch/pull/17894
This PR creates replacements for JSM's AccessController which is marked for removal from the JDK. While JSM was replaced with the java agent in 3.0.0, the logic to extract the ProtectionDomains from the call stack relies on the AccessController to limit the frames when examining the stack. The java agent needs to retain this code marker to know when to stop walking the stack and this PR creates OpenSearch equivalents to the AccessController which is a simple wrapper around a runnable block of code.
Related Issues
Resolves https://github.com/opensearch-project/OpenSearch/issues/18339
Check List
- [ ] Functionality includes testing.
- [ ] API changes companion pull request created, if applicable.
- [ ] Public documentation issue/PR created, if applicable.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. For more information on following Developer Certificate of Origin and signing off your commits, please check here.
:white_check_mark: Gradle check result for 366406f9e5374e2cfc7141f0fbd4752aeeb203d4: SUCCESS
Codecov Report
Attention: Patch coverage is 50.00000% with 14 lines in your changes missing coverage. Please review.
Project coverage is 72.62%. Comparing base (
a8bd494) to head (e7270f7). Report is 6 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #18346 +/- ##
============================================
- Coverage 72.81% 72.62% -0.19%
+ Complexity 68209 68113 -96
============================================
Files 5541 5542 +1
Lines 313390 313396 +6
Branches 45472 45472
============================================
- Hits 228196 227608 -588
- Misses 66671 67247 +576
- Partials 18523 18541 +18
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
:grey_exclamation: Gradle check result for 53be672b0fd336d23981084c56024f852a7285d7: UNSTABLE
Please review all flaky tests that succeeded after retry and create an issue if one does not already exist to track the flaky failure.
:x: Gradle check result for 00c22c711a30ffe9099308d0d5a6011878a5c347: null
Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?
:x: Gradle check result for d79bdc153e8bc3d475a3f5a41af34ed4d717e166: FAILURE
Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?
:x: Gradle check result for 9cfa314236c1ff7f8b1680852dc540fd60235856: FAILURE
Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?
:x: Gradle check result for 9cfa314236c1ff7f8b1680852dc540fd60235856: FAILURE
Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?
:white_check_mark: Gradle check result for 9cfa314236c1ff7f8b1680852dc540fd60235856: SUCCESS
:x: Gradle check result for 995c66cff19dad5cd60d1528b46e51cc8d807e34: FAILURE
Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?
:white_check_mark: Gradle check result for 5b04b59f6ee7efc7686e9af97b6140f67b31a4ac: SUCCESS
:x: Gradle check result for f0541319d594e791c0b175d0b14cd27bf83aeda7: FAILURE
Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?
:x: Gradle check result for f0541319d594e791c0b175d0b14cd27bf83aeda7: FAILURE
Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?
:white_check_mark: Gradle check result for 9c44efb399e53c50bd90ffa23ffebf4823378191: SUCCESS
:white_check_mark: Gradle check result for e81fdf51ab8078077cdb29bfe408a2f37c4dfe0c: SUCCESS
:x: Gradle check result for e73577338351b4dd9ecbb59929912449e684ab8c: FAILURE
Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?
:x: Gradle check result for 293fd830d7444b808838f16322f8785c0cfda71d: FAILURE
Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?
:x: Gradle check result for 9dc57802e969a81a618977e666796cdff20aa015: FAILURE
Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?
:white_check_mark: Gradle check result for fc6a21bd2eb431823d435d0ac128c767d6d3f30c: SUCCESS
@andrross All comments have been addressed. Can you re-review this PR?
:white_check_mark: Gradle check result for 9a3f3f2d265f9c5da52fd2828eb159ae52e8cc2f: SUCCESS
This is going to need changing the imports across multiple plugins?
This is going to need changing the
importsacross multiple plugins?
@kumargu We'll continue to support both the JDK-based access controller and the new version as long as the JDK still contains those classes. Plugins should have a long time to make the update (likely the entire 3.x series at least).
This is going to need changing the
importsacross multiple plugins?@kumargu We'll continue to support both the JDK-based access controller and the new version as long as the JDK still contains those classes. Plugins should have a long time to make the update (likely the entire 3.x series at least).
Gotcha. makes sense.
:white_check_mark: Gradle check result for 8950858e30fefd51c46220485cbf72fa754a282d: SUCCESS
:x: Gradle check result for c6a61fc073613c9bb01659939ea4e0a1dcc13154: FAILURE
Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?
:x: Gradle check result for 5c32ba24ec739d953889a973f637421aa3b77555: FAILURE
Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?
:grey_exclamation: Gradle check result for 5c32ba24ec739d953889a973f637421aa3b77555: UNSTABLE
Please review all flaky tests that succeeded after retry and create an issue if one does not already exist to track the flaky failure.
:white_check_mark: Gradle check result for e7270f773c7a893b0e180aed7f75c0b6d5bda469: SUCCESS