OpenSearch icon indicating copy to clipboard operation
OpenSearch copied to clipboard

Create equivalents of JSM's AccessController in the java agent

Open cwperks opened this issue 7 months ago • 16 comments

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.

cwperks avatar May 20 '25 20:05 cwperks

:white_check_mark: Gradle check result for 366406f9e5374e2cfc7141f0fbd4752aeeb203d4: SUCCESS

github-actions[bot] avatar May 20 '25 21:05 github-actions[bot]

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.

Files with missing lines Patch % Lines
...va/org/opensearch/ingest/geoip/GeoIpProcessor.java 44.44% 10 Missing :warning:
...ent/StackCallerProtectionDomainChainExtractor.java 0.00% 4 Missing :warning:
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.

codecov[bot] avatar May 20 '25 21:05 codecov[bot]

: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.

github-actions[bot] avatar May 21 '25 17:05 github-actions[bot]

: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?

github-actions[bot] avatar May 22 '25 20:05 github-actions[bot]

: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?

github-actions[bot] avatar May 23 '25 20:05 github-actions[bot]

: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?

github-actions[bot] avatar May 23 '25 21:05 github-actions[bot]

: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?

github-actions[bot] avatar May 23 '25 23:05 github-actions[bot]

:white_check_mark: Gradle check result for 9cfa314236c1ff7f8b1680852dc540fd60235856: SUCCESS

github-actions[bot] avatar May 24 '25 13:05 github-actions[bot]

: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?

github-actions[bot] avatar May 29 '25 15:05 github-actions[bot]

:white_check_mark: Gradle check result for 5b04b59f6ee7efc7686e9af97b6140f67b31a4ac: SUCCESS

github-actions[bot] avatar May 29 '25 18:05 github-actions[bot]

: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?

github-actions[bot] avatar Jun 02 '25 14:06 github-actions[bot]

: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?

github-actions[bot] avatar Jun 06 '25 21:06 github-actions[bot]

:white_check_mark: Gradle check result for 9c44efb399e53c50bd90ffa23ffebf4823378191: SUCCESS

github-actions[bot] avatar Jun 10 '25 17:06 github-actions[bot]

:white_check_mark: Gradle check result for e81fdf51ab8078077cdb29bfe408a2f37c4dfe0c: SUCCESS

github-actions[bot] avatar Jun 10 '25 19:06 github-actions[bot]

: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?

github-actions[bot] avatar Jun 11 '25 22:06 github-actions[bot]

: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?

github-actions[bot] avatar Jun 13 '25 14:06 github-actions[bot]

: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?

github-actions[bot] avatar Jun 17 '25 21:06 github-actions[bot]

:white_check_mark: Gradle check result for fc6a21bd2eb431823d435d0ac128c767d6d3f30c: SUCCESS

github-actions[bot] avatar Jun 18 '25 21:06 github-actions[bot]

@andrross All comments have been addressed. Can you re-review this PR?

cwperks avatar Jun 19 '25 03:06 cwperks

:white_check_mark: Gradle check result for 9a3f3f2d265f9c5da52fd2828eb159ae52e8cc2f: SUCCESS

github-actions[bot] avatar Jun 19 '25 22:06 github-actions[bot]

This is going to need changing the imports across multiple plugins?

kumargu avatar Jun 20 '25 04:06 kumargu

This is going to need changing the imports across 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).

andrross avatar Jun 20 '25 14:06 andrross

This is going to need changing the imports across 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.

kumargu avatar Jun 20 '25 14:06 kumargu

:white_check_mark: Gradle check result for 8950858e30fefd51c46220485cbf72fa754a282d: SUCCESS

github-actions[bot] avatar Jun 20 '25 16:06 github-actions[bot]

: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?

github-actions[bot] avatar Jun 20 '25 20:06 github-actions[bot]

: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?

github-actions[bot] avatar Jun 20 '25 22:06 github-actions[bot]

: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.

github-actions[bot] avatar Jun 21 '25 00:06 github-actions[bot]

:white_check_mark: Gradle check result for e7270f773c7a893b0e180aed7f75c0b6d5bda469: SUCCESS

github-actions[bot] avatar Jun 21 '25 14:06 github-actions[bot]