Skip to content

Fix java.security.AccessControlException during OpenSearch server shutdown cycle #17183

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

Merged
merged 1 commit into from
Jan 29, 2025

Conversation

reta
Copy link
Contributor

@reta reta commented Jan 29, 2025

Description

So far I have only seen it during the server shutdown procedure:

java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "getClassLoader")                                                                       
        at java.base/java.security.AccessControlContext.checkPermission(AccessControlContext.java:488) ~[?:?]                                                              
        at java.base/java.security.AccessController.checkPermission(AccessController.java:1085) ~[?:?]                                                                     
        at java.base/java.lang.SecurityManager.checkPermission(SecurityManager.java:411) ~[?:?]                                                                            
        at java.base/java.lang.ClassLoader.checkClassLoaderPermission(ClassLoader.java:2071) ~[?:?]                                                                        
        at java.base/java.lang.Thread.getContextClassLoader(Thread.java:2284) ~[?:?]
        at io.netty.util.concurrent.GlobalEventExecutor.startThread(GlobalEventExecutor.java:239) ~[netty-common-4.1.117.Final.jar:4.1.117.Final]
        at io.netty.util.concurrent.GlobalEventExecutor.execute0(GlobalEventExecutor.java:232) ~[netty-common-4.1.117.Final.jar:4.1.117.Final]
        at io.netty.util.concurrent.GlobalEventExecutor.execute(GlobalEventExecutor.java:226) ~[netty-common-4.1.117.Final.jar:4.1.117.Final]
        at io.netty.util.concurrent.DefaultPromise.safeExecute(DefaultPromise.java:862) [netty-common-4.1.117.Final.jar:4.1.117.Final]
        at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:500) [netty-common-4.1.117.Final.jar:4.1.117.Final]
        at io.netty.util.concurrent.DefaultPromise.setValue0(DefaultPromise.java:636) [netty-common-4.1.117.Final.jar:4.1.117.Final]
        at io.netty.util.concurrent.DefaultPromise.setSuccess0(DefaultPromise.java:625) [netty-common-4.1.117.Final.jar:4.1.117.Final]
        at io.netty.util.concurrent.DefaultPromise.setSuccess(DefaultPromise.java:97) [netty-common-4.1.117.Final.jar:4.1.117.Final]
        at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:1059) [netty-common-4.1.117.Final.jar:4.1.117.Final]
        at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) [netty-common-4.1.117.Final.jar:4.1.117.Final]
        at java.base/java.lang.Thread.run(Thread.java:1575) [?:?]

Related Issues

Related to #17041

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.

Copy link
Contributor

❕ Gradle check result for 7311a01: 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.

Copy link

codecov bot commented Jan 29, 2025

Codecov Report

Attention: Patch coverage is 81.81818% with 4 lines in your changes missing coverage. Please review.

Project coverage is 72.31%. Comparing base (7306905) to head (c32e2fb).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
...ch/common/util/concurrent/OpenSearchExecutors.java 83.33% 2 Missing and 1 partial ⚠️
...ensearch/transport/reactor/SharedGroupFactory.java 50.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #17183      +/-   ##
============================================
- Coverage     72.36%   72.31%   -0.05%     
+ Complexity    65606    65594      -12     
============================================
  Files          5306     5306              
  Lines        304923   304941      +18     
  Branches      44256    44257       +1     
============================================
- Hits         220665   220533     -132     
- Misses        66151    66344     +193     
+ Partials      18107    18064      -43     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

❌ Gradle check result for 13b0127: 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?

Copy link
Contributor

✅ Gradle check result for c32e2fb: SUCCESS

@reta
Copy link
Contributor Author

reta commented Jan 29, 2025

@andrross @msfroh please take a look folks if you have a minute, thank you!

Copy link
Contributor

@msfroh msfroh left a comment

Choose a reason for hiding this comment

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

Seems reasonable to me.

Obviously, we'll want to keep an eye on uses of PrivilegedOpenSearchThreadFactory as long as we're relying on JSM policies.

@reta
Copy link
Contributor Author

reta commented Jan 29, 2025

Seems reasonable to me.

Thanks @msfroh , I've sent the fix upstream as well (netty/netty#14743)

@reta reta merged commit b9900ee into opensearch-project:main Jan 29, 2025
59 checks passed
@reta reta added backport 1.x backport 1.3 Backport to 1.3 branch labels Jan 29, 2025
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jan 29, 2025
…tdown cycle (#17183)

Signed-off-by: Andriy Redko <[email protected]>
(cherry picked from commit b9900ee)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
@opensearch-trigger-bot
Copy link
Contributor

The backport to 1.3 failed:

The process '/usr/bin/git' failed with exit code 128

To backport manually, run these commands in your terminal:

# Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/OpenSearch/backport-1.3 1.3
# Navigate to the new working tree
pushd ../.worktrees/OpenSearch/backport-1.3
# Create a new branch
git switch --create backport/backport-17183-to-1.3
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 b9900ee5c36dd73925babfa4d29c8d085f48b962
# Push it to GitHub
git push --set-upstream origin backport/backport-17183-to-1.3
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/OpenSearch/backport-1.3

Then, create a pull request where the base branch is 1.3 and the compare/head branch is backport/backport-17183-to-1.3.

@opensearch-trigger-bot
Copy link
Contributor

The backport to 1.x failed:

The process '/usr/bin/git' failed with exit code 128

To backport manually, run these commands in your terminal:

# Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/OpenSearch/backport-1.x 1.x
# Navigate to the new working tree
pushd ../.worktrees/OpenSearch/backport-1.x
# Create a new branch
git switch --create backport/backport-17183-to-1.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 b9900ee5c36dd73925babfa4d29c8d085f48b962
# Push it to GitHub
git push --set-upstream origin backport/backport-17183-to-1.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/OpenSearch/backport-1.x

Then, create a pull request where the base branch is 1.x and the compare/head branch is backport/backport-17183-to-1.x.

reta pushed a commit that referenced this pull request Jan 29, 2025
…tdown cycle (#17183) (#17189)

(cherry picked from commit b9900ee)

Signed-off-by: Andriy Redko <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
reta added a commit to reta/OpenSearch that referenced this pull request Jan 30, 2025
reta added a commit to reta/OpenSearch that referenced this pull request Jan 30, 2025
reta added a commit that referenced this pull request Jan 30, 2025
…tdown cycle (#17183) (#17205)

Signed-off-by: Andriy Redko <[email protected]>
(cherry picked from commit b9900ee)
reta added a commit that referenced this pull request Jan 30, 2025
…tdown cycle (#17183) (#17204)

Signed-off-by: Andriy Redko <[email protected]>
(cherry picked from commit b9900ee)
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.

2 participants