Skip to content

Conversation

@pranu2502
Copy link
Contributor

Description

Increased the scope o File Interceptor to intercept methods from FileSystemProvider.class and modified the i conditions to catch args baded on theit class types

Related Issues

Resolves #[Issue number to be closed when this PR is merged]

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.

@pranu2502 pranu2502 changed the title Increased the scope o File Interceptor ro intercept methods from FileSystemProvider.class Increased the scope of File Interceptor ro intercept methods from FileSystemProvider.class Apr 17, 2025
@github-actions
Copy link
Contributor

❌ Gradle check result for e5c1ac7: 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
Copy link
Contributor

❌ Gradle check result for e5c1ac7: 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
Copy link
Contributor

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

@pranu2502 pranu2502 changed the title Increased the scope of File Interceptor ro intercept methods from FileSystemProvider.class Increased the scope of File Interceptor to intercept methods from FileSystemProvider.class Apr 18, 2025
@github-actions
Copy link
Contributor

❌ Gradle check result for 8aa9cdc: 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
Copy link
Contributor

❌ Gradle check result for 355d48b: 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
Copy link
Contributor

❌ Gradle check result for 8771d25: 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
Copy link
Contributor

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

@cwperks
Copy link
Member

cwperks commented Apr 21, 2025

@reta FYI This is another instance where the agent is divergent from JSM with stack walking. The agent is not currently blocking newByteChannel calls as expected since its not included on this line.

After adding a check for newByteChannel (in addition to open) many tests are failing with this stack trace:

1> Caused by: java.lang.SecurityException: Denied OPEN (read) access to file: /sys/fs/cgroup/user.slice/user-1000.slice/session-3.scope/memory.swap.max, domain: ProtectionDomain  (file:/var/jenkins/workspace/gradle-check/search/server/build/distributions/opensearch-3.0.0-SNAPSHOT.jar <no signer certificates>)
  1>  jdk.internal.loader.ClassLoaders$AppClassLoader@36baf30c
  1>  <no principals>
  1>  java.security.Permissions@78010bbd (
  1>  ("java.net.SocketPermission" "localhost:0" "listen,resolve")
  1>  ("java.io.FilePermission" "/var/jenkins/workspace/gradle-check/search/ser  1> ver/build/distributions/opensearch-3.0.0-SNAPSHOT.jar#plus" "read")
  1>  ("java.io.FilePermission" "/var/jenkins/workspace/gradle-check/search/server/build/distributions/opensearch-3.0.0-SNAPSHOT.jar" "read")
  1>  ("java.lang.RuntimePermission" "accessClassInPackage.com.sun.beans.*")
  1>  ("java.lang.RuntimePermission" "accessClassInPackage.com.apple.*")
  1>  ("java.lang.RuntimePermission" "accessClassInPackage.com.sun.java.swing.plaf.*")
  1>  ("java.lang.RuntimePermission" "exitVM")
  1>  ("java.lang.RuntimePermission" "accessClassInPackage.com.sun.beans")
  1>  ("java.util.PropertyPermission" "java.specification.version" "read")
  1>  ("java.util.PropertyPermission" "java.vm.vendor" "read")
  1>  ("java.util.PropertyPermission" "path.separator" "read")
  1>  ("java.util.PropertyPermission" "os.version" "read")
  1>  ("java.util.PropertyPermission" "java.vendor.url" "read")
  1>  ("java.util.PropertyPermission" "java.vm.name" "read")
  1>  ("java.util.PropertyPermission" "java.vm.specification.version" "read")
  1>  ("java.util.PropertyPermission" "os.name" "read")
  1>  ("java.util.PropertyPermission" "java.version" "read")
  1>  ("java.util.PropertyPermission" "os.arch" "read")
  1>  ("java.util.PropertyPermission" "java.specification.vendor" "read")
  1>  ("java.util.PropertyPermission" "java.vm.specification.name" "read")
  1>  ("java.util.PropertyPermission" "file.separator" "read")
  1>  ("java.util.PropertyPermission" "line.separator" "read")
  1>  ("java.util.PropertyPermission" "java.vm.specification.vendor" "read")
  1>  ("java.util.PropertyPermission" "java.specification.name" "read")
  1>  ("java.util.PropertyPermission" "java.vendor" "read")
  1>  ("java.util.PropertyPermission" "java.vm.version" "read")
  1>  ("java.util.PropertyPermission" "java.specification.maintenance.version" "read")
  1>  ("java.util.PropertyPermission" "java.class.version" "read")
  1> )


  1> 	at java.nio.file.Files.newByteChannel(Files.java:426) ~[?:?]
  1> 	at java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:420) ~[?:?]
  1> 	at java.nio.file.Files.newInputStream(Files.java:160) ~[?:?]
  1> 	at java.nio.file.Files.newBufferedReader(Files.java:2910) ~[?:?]
  1> 	at java.nio.file.Files.newBufferedReader(Files.java:2943) ~[?:?]
  1> 	at jdk.internal.platform.CgroupUtil.lambda$readStringValue$1(CgroupUtil.java:67) ~[?:?]
  1> 	at java.security.AccessController.doPrivileged(AccessController.java:571) ~[?:?]
  1> 	at jdk.internal.platform.CgroupUtil.readStringValue(CgroupUtil.java:69) ~[?:?]
  1> 	at jdk.internal.platform.CgroupSubsystemController.getStringValue(CgroupSubsystemController.java:65) ~[?:?]
  1> 	at jdk.internal.platform.cgroupv2.CgroupV2Subsystem.getMemoryAndSwapLimit(CgroupV2Subsystem.java:268) ~[?:?]
  1> 	at jdk.internal.platform.CgroupMetrics.getMemoryAndSwapLimit(CgroupMetrics.java:151) ~[?:?]
  1> 	at com.sun.management.internal.OperatingSystemImpl.getTotalSwapSpaceSize(OperatingSystemImpl.java:184) ~[?:?]
  1> 	at jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[?:?]
  1> 	... 51 more
  1> [2025-04-18T10:01:57,144][WARN ][o.o.m.o.OsProbe          ] [testRangeQueriesWithNow] exception retrieving free swap space size
  1> java.lang.reflect.InvocationTargetException: null
  1> 	at jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:118) ~[?:?]
  1> 	at java.lang.reflect.Method.invoke(Method.java:580) ~[?:?]
  1> 	at org.opensearch.monitor.os.OsProbe.getFreeSwapSpaceSize(OsProbe.java:151) ~[opensearch-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
  1> 	at org.opensearch.monitor.os.OsProbe.osStats(OsProbe.java:694) ~[opensearch-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
  1> 	at org.opensearch.monitor.os.OsService.<init>(OsService.java:71) ~[opensearch-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
  1> 	at org.opensearch.monitor.MonitorService.<init>(MonitorService.java:64) ~[opensearch-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
  1> 	at org.opensearch.node.Node.<init>(Node.java:787) ~[opensearch-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
  1> 	at org.opensearch.node.MockNode.<init>(MockNode.java:121) ~[framework-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
  1> 	at org.opensearch.node.MockNode.<init>(MockNode.java:109) ~[framework-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
  1> 	at org.opensearch.node.MockNode.<init>(MockNode.java:100) ~[framework-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
  1> 	at org.opensearch.test.OpenSearchSingleNodeTestCase.newNode(OpenSearchSingleNodeTestCase.java:275) ~[framework-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
  1> 	at com.carrotsearch.randomizedtesting.RandomizedContext.runWithPrivateRandomness(RandomizedContext.java:187) ~[randomizedtesting-runner-2.7.1.jar:?]
  1> 	at com.carrotsearch.randomizedtesting.RandomizedContext.runWithPrivateRandomness(RandomizedContext.java:211) ~[randomizedtesting-runner-2.7.1.jar:?]
  1> 	at org.opensearch.test.OpenSearchSingleNodeTestCase.startNode(OpenSearchSingleNodeTestCase.java:106) ~[framework-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
  1> 	at org.opensearch.test.OpenSearchSingleNodeTestCase.setUp(OpenSearchSingleNodeTestCase.java:145) ~[framework-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
  1> 	at jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[?:?]
  1> 	at java.lang.reflect.Method.invoke(Method.java:580) ~[?:?]
  1> 	at com.carrotsearch.randomizedtesting.RandomizedRunner.invoke(RandomizedRunner.java:1750) ~[randomizedtesting-runner-2.7.1.jar:?]
  1> 	at com.carrotsearch.randomizedtesting.RandomizedRunner$9.evaluate(RandomizedRunner.java:972) ~[randomizedtesting-runner-2.7.1.jar:?]
  1> 	at com.carrotsearch.randomizedtesting.RandomizedRunner$10.evaluate(RandomizedRunner.java:988) ~[randomizedtesting-runner-2.7.1.jar:?]
  1> 	at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36) ~[randomizedtesting-runner-2.7.1.jar:?]
  1> 	at org.junit.rules.RunRules.evaluate(RunRules.java:20) ~[junit-4.13.2.jar:4.13.2]
  1> 	at org.apache.lucene.tests.util.TestRuleSetupTeardownChained$1.evaluate(TestRuleSetupTeardownChained.java:48) ~[lucene-test-framework-10.1.0.jar:10.1.0 884954006de769dc43b811267230d625886e6515 - 2024-12-17 16:15:44]
  1> 	at org.apache.lucene.tests.util.AbstractBeforeAfterRule$1.evaluate(AbstractBeforeAfterRule.java:43) ~[lucene-test-framework-10.1.0.jar:10.1.0 884954006de769dc43b811267230d625886e6515 - 2024-12-17 16:15:44]
  1> 	at org.apache.lucene.tests.util.TestRuleThreadAndTestName$1.evaluate(TestRuleThreadAndTestName.java:45) ~[lucene-test-framework-10.1.0.jar:10.1.0 884954006de769dc43b811267230d625886e6515 - 2024-12-17 16:15:44]
  1> 	at org.apache.lucene.tests.util.TestRuleIgnoreAfterMaxFailures$1.evaluate(TestRuleIgnoreAfterMaxFailures.java:60) ~[lucene-test-framework-10.1.0.jar:10.1.0 884954006de769dc43b811267230d625886e6515 - 2024-12-17 16:15:44]
  1> 	at org.apache.lucene.tests.util.TestRuleMarkFailure$1.evaluate(TestRuleMarkFailure.java:44) ~[lucene-test-framework-10.1.0.jar:10.1.0 884954006de769dc43b811267230d625886e6515 - 2024-12-17 16:15:44]
  1> 	at org.junit.rules.RunRules.evaluate(RunRules.java:20) ~[junit-4.13.2.jar:4.13.2]
  1> 	at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36) ~[randomizedtesting-runner-2.7.1.jar:?]
  1> 	at com.carrotsearch.randomizedtesting.ThreadLeakControl$StatementRunner.run(ThreadLeakControl.java:368) ~[randomizedtesting-runner-2.7.1.jar:?]
  1> 	at com.carrotsearch.randomizedtesting.ThreadLeakControl.forkTimeoutingTask(ThreadLeakControl.java:817) ~[randomizedtesting-runner-2.7.1.jar:?]
  1> 	at com.carrotsearch.randomizedtesting.ThreadLeakControl$3.evaluate(ThreadLeakControl.java:468) ~[randomizedtesting-runner-2.7.1.jar:?]
  1> 	at com.carrotsearch.randomizedtesting.RandomizedRunner.runSingleTest(RandomizedRunner.java:947) ~[randomizedtesting-runner-2.7.1.jar:?]
  1> 	at com.carrotsearch.randomizedtesting.RandomizedRunner$5.evaluate(RandomizedRunner.java:832) ~[randomizedtesting-runner-2.7.1.jar:?]
  1> 	at com.carrotsearch.randomizedtesting.RandomizedRunner$6.evaluate(RandomizedRunner.java:883) ~[randomizedtesting-runner-2.7.1.jar:?]
  1> 	at com.carrotsearch.randomizedtesting.RandomizedRunner$7.evaluate(RandomizedRunner.java:894) ~[randomizedtesting-runner-2.7.1.jar:?]
  1> 	at org.apache.lucene.tests.util.AbstractBeforeAfterRule$1.evaluate(AbstractBeforeAfterRule.java:43) ~[lucene-test-framework-10.1.0.jar:10.1.0 884954006de769dc43b811267230d625886e6515 - 2024-12-17 16:15:44]
  1> 	at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36) ~[randomizedtesting-runner-2.7.1.jar:?]
  1> 	at org.apache.lucene.tests.util.TestRuleStoreClassName$1.evaluate(TestRuleStoreClassName.java:38) ~[lucene-test-framework-10.1.0.jar:10.1.0 884954006de769dc43b811267230d625886e6515 - 2024-12-17 16:15:44]
  1> 	at com.carrotsearch.randomizedtesting.rules.NoShadowingOrOverridesOnMethodsRule$1.evaluate(NoShadowingOrOverridesOnMethodsRule.java:40) ~[randomizedtesting-runner-2.7.1.jar:?]
  1> 	at com.carrotsearch.randomizedtesting.rules.NoShadowingOrOverridesOnMethodsRule$1.evaluate(NoShadowingOrOverridesOnMethodsRule.java:40) ~[randomizedtesting-runner-2.7.1.jar:?]
  1> 	at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36) ~[randomizedtesting-runner-2.7.1.jar:?]
  1> 	at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36) ~[randomizedtesting-runner-2.7.1.jar:?]
  1> 	at org.apache.lucene.tests.util.TestRuleAssertionsRequired$1.evaluate(TestRuleAssertionsRequired.java:53) ~[lucene-test-framework-10.1.0.jar:10.1.0 884954006de769dc43b811267230d625886e6515 - 2024-12-17 16:15:44]
  1> 	at org.apache.lucene.tests.util.AbstractBeforeAfterRule$1.evaluate(AbstractBeforeAfterRule.java:43) ~[lucene-test-framework-10.1.0.jar:10.1.0 884954006de769dc43b811267230d625886e6515 - 2024-12-17 16:15:44]
  1> 	at org.apache.lucene.tests.util.TestRuleMarkFailure$1.evaluate(TestRuleMarkFailure.java:44) ~[lucene-test-framework-10.1.0.jar:10.1.0 884954006de769dc43b811267230d625886e6515 - 2024-12-17 16:15:44]
  1> 	at org.apache.lucene.tests.util.TestRuleIgnoreAfterMaxFailures$1.evaluate(TestRuleIgnoreAfterMaxFailures.java:60) ~[lucene-test-framework-10.1.0.jar:10.1.0 884954006de769dc43b811267230d625886e6515 - 2024-12-17 16:15:44]
  1> 	at org.apache.lucene.tests.util.TestRuleIgnoreTestSuites$1.evaluate(TestRuleIgnoreTestSuites.java:47) ~[lucene-test-framework-10.1.0.jar:10.1.0 884954006de769dc43b811267230d625886e6515 - 2024-12-17 16:15:44]
  1> 	at org.junit.rules.RunRules.evaluate(RunRules.java:20) ~[junit-4.13.2.jar:4.13.2]
  1> 	at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36) ~[randomizedtesting-runner-2.7.1.jar:?]
  1> 	at com.carrotsearch.randomizedtesting.ThreadLeakControl$StatementRunner.run(ThreadLeakControl.java:368) ~[randomizedtesting-runner-2.7.1.jar:?]
  1> 	at java.lang.Thread.run(Thread.java:1583) [?:?]

As you can see from the stack trace, its coming from instantiating the MonitoringService on the Node Bootstrap flow, which ends up calling OsProbe.getFreeSwapSpaceSize which is coming from the OperatingSystemMxBean

In the stack trace I can see AccessController.doPrivileged with all JDK classes above the frame. With JSM authz is skipped here since its all JDK classes, but with the agent its going further up the stack.

In this case, will we need to grants in security.policy similar to all of the new SocketPermission declarations since the agent was merged?

ref Jenkins run with failures after intercepting newByteChannel: https://build.ci.opensearch.org/job/gradle-check/56685/consoleText

@github-actions
Copy link
Contributor

❌ Gradle check result for 07fee01: 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
Copy link
Contributor

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

@reta
Copy link
Contributor

reta commented Apr 21, 2025

@reta FYI This is another instance where the agent is divergent from JSM with stack walking. The agent is not currently blocking newByteChannel calls as expected since its not included on this line.

@cwperks you are very right, we have quite large API surface to cover, the incremental approach (like this one) would help us to close the gaps for sure, thank you

In this case, will we need to grants in security.policy similar to all of the new SocketPermission declarations since the agent was merged?

Yes, we may need to update policies, thank you.

@github-actions
Copy link
Contributor

❌ Gradle check result for b89a18c: 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
Copy link
Contributor

❌ Gradle check result for 4da2f19: 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?

@pranu2502 pranu2502 closed this Apr 25, 2025
@github-actions
Copy link
Contributor

github-actions bot commented May 3, 2025

❌ Gradle check result for 943d3c7: 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
Copy link
Contributor

github-actions bot commented May 3, 2025

❌ Gradle check result for bcd6044: 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
Copy link
Contributor

github-actions bot commented May 3, 2025

❌ Gradle check result for a8c3dab: 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
Copy link
Contributor

github-actions bot commented May 3, 2025

❌ Gradle check result for 58fb0d7: 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
Copy link
Contributor

github-actions bot commented May 3, 2025

✅ Gradle check result for fb808c8: SUCCESS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants