Repository navigation
Conversation
Code that reflects on sun.nio.ch internals, for example to tune NIO sockets or selectors, fails with InaccessibleObjectException on JDK 17+ unless the package is opened to the unnamed module. Add the flag next to the other java.base opens on every launch path: - bin/karaf and bin/karaf.bat - child instances started by instance:start (InstanceServiceImpl) - service wrapper configurations (unix, windows, windows64) - Pax Exam options in KarafTestSupport and KarafMinimalMonitoredTestSupport Fixes apache#2299
Test Results1 112 files ±0 1 112 suites ±0 1h 13m 45s ⏱️ - 17m 18s For more details on these failures, see this check. Results for commit 3fc4767. ± Comparison against base commit e74d795. ♻️ This comment has been updated with latest results. |
Member
Author
|
It needs the #3145 fix. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2299.
Context
Code that reflects on
sun.nio.chinternals, for example to tune NIO sockets or selectors, fails withInaccessibleObjectExceptionon JDK 17+ unless the package is opened. Users can add the flag throughEXTRA_JAVA_OPTSinbin/setenv, but that only reachesbin/karaf. It doesn't reach the service wrapper or child instances started withinstance:start.#2300 (by @mattrpav) was closed as already covered by the JDK 21 lift (#2214), but #2214 doesn't contain the flag and neither
mainnorkaraf-4.4.xhas it. #2840 (by @Alwaysgaurav1) covered every launch path but was closed as a duplicate of #2300, and it no longer applies after #2214. This PR picks the change up again on currentmain. Thanks to both.Changes
--add-opens java.base/sun.nio.ch=ALL-UNNAMEDis added next to the otherjava.baseopens in:bin/karafandbin/karaf.bat(instance scriptsexecthe rootbin/karaf)InstanceServiceImpl, for child instances started byinstance:startunix,windowsandwindows64karaf-wrapper-java11.confKarafTestSupportandKarafMinimalMonitoredTestSupportTesting
JDK 21,
apache-karafdistribution built from this branch. The probe, run from the console, is(($.context bundle 0) loadClass "sun.nio.ch.SelectorImpl") getDeclaredField "selectedKeys"followed bytrySetAccessible:trySetAccessiblebin/karafwithout the flag (control)falsebin/starttrueinstance:create+instance:starttruewrapper:install: generatedetc/karaf-wrapper.confJDK_JAVA_OPTIONSvaluetrueThe bundled macOS wrapper binary is a PowerPC Mach-O and doesn't run on current Macs. For the wrapper row, Karaf was started with the generated
JDK_JAVA_OPTIONSvalue in the environment, which is how the wrapper passes it.mvn test -pl instance: 36 tests, 0 failures.itests/test,-Dtest=InstanceTest,SystemTest,MavenResolverRegisteredBeforeConfigAdminTest,MavenResolverRegisteredOnlyAfterConfigAdminTest: 18 tests, 0 failures.pson a running Pax Exam container shows the new option.