GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||
GeezerVison is showing github.com — Prepare for unsafe memory access deprecated for removal by chrisvest · Pull Request #14090 · netty/netty Conversation
|
|
@pron @ChrisHegarty FYI. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
✅ I've done two builds locally, with a snapshot build of JDK 23, and things work as we'd expected with and without |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@normanmaurer Once JDK 23 is GA, we should add another PR build with |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Hi. Now is indeed the time to prepare for A simpler and more future-proof approach is to remove the use of Unsafe altogether from versions of the library targeting new JDK versions. If you wish to choose the "one-size-fits-all" approach, where a library targets many JDK versions with the same binary artefact, you may want to consider a multi-release JAR (MR-JAR). |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
336a4d5 to
004e183
Compare
This also removes the "seek ahead optimised" version of HTTP POST form field parsing, which was subtly broken, and - it turns out - was not any faster than the non-optimised version.
004e183 to
bafc6b5
Compare
|
I've proposed removing the use of Unsafe in Netty 5 with #14033. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@chrisvest thanks! I will cherry-pick this to 4.2 as well. Not sure what todo about main, thoughts ? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@normanmaurer The pom.xml and PlatformDependent* changes should also be applicable to main. Whatever else is necessary has to be discovered by running builds on JDK 23 with |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Motivation: Java 23 will introduce JEP 471 (https://openjdk.org/jeps/471) which deprecates all unsafe memory access methods for removal. The JEP also starts the removal phase, by introducing a new `--sun-misc-unsafe-memory-access={allow|warn|debug|deny}` command line option. Initially, unsafe memory access will be allowed, but will in future Java versions produce warnings, and then eventually denying access by default. When access is denied, then calling the unsafe memory access methods will produce an `UnsupportedOperationException`. Modification: Include the value of `--sun-misc-unsafe-memory-access` in the consideration of explicit-no-unsafe computation. The command line value is available as the `sun.misc.unsafe.memory.access` system property. If the value is not either "allow" or unspecified, then unsafe is explicitly turned off. Add many more tests to the unsafe availability, probing for all the unsafe memory access methods we use, and also testing some of them with direct calls. Result: We should hopefully not see any warnings, or "NoSuchMethodErrors", in the future.
Motivation: netty#14090 added multiple reflective accesses on netty initialization to probe availability of Unsafe methods which may be removed after java 23 (jep 471). This may have negative performance impact on application startup (particularly with lower end machines) since reflection is expensive before jvm is warmed up. However, these reflective method probes may be potentially useful only after java 23 - when/if method removals actually materialize. Modification: Make reflective accesses on netty initialization to probe availability of Unsafe methods only if java version > 23. Result: Unnecessary reflective accesses on netty initialization are avoided for java version <= 23.
Motivation: #14090 added multiple reflective accesses on netty initialization to probe availability of Unsafe methods which may be removed after java 23 (jep 471). This may have negative performance impact on application startup (particularly with lower end machines) since reflection is expensive before jvm is warmed up. However, these reflective method probes may be potentially useful only after java 23 - when/if method removals actually materialize. Modification: Make reflective accesses on netty initialization to probe availability of Unsafe methods only if java version > 23. Result: Unnecessary reflective accesses on netty initialization are avoided for java version <= 23.
Motivation: #14090 added multiple reflective accesses on netty initialization to probe availability of Unsafe methods which may be removed after java 23 (jep 471). This may have negative performance impact on application startup (particularly with lower end machines) since reflection is expensive before jvm is warmed up. However, these reflective method probes may be potentially useful only after java 23 - when/if method removals actually materialize. Modification: Make reflective accesses on netty initialization to probe availability of Unsafe methods only if java version > 23. Result: Unnecessary reflective accesses on netty initialization are avoided for java version <= 23.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.