HADOOP-19310. Add JPMS options required by Java 17+ (#7114) Contributed by Cheng Pan.

Reviewed-by: Attila Doroszlai <adoroszlai@apache.org>
Signed-off-by: Shilun Fan <slfan1989@apache.org>
This commit is contained in:
Cheng Pan 2024-10-16 14:15:01 +08:00 committed by GitHub
parent e4b070025b
commit 9321e322d2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 25 additions and 3 deletions

View File

@ -1571,12 +1571,21 @@ function hadoop_finalize_hadoop_opts
## @description Finish configuring JPMS that enforced for JDK 17 and higher ## @description Finish configuring JPMS that enforced for JDK 17 and higher
## @description prior to executing Java ## @description prior to executing Java
## @description keep this list sync with hadoop-project/pom.xml extraJavaTestArgs
## @audience private ## @audience private
## @stability evolving ## @stability evolving
## @replaceable yes ## @replaceable yes
function hadoop_finalize_jpms_opts function hadoop_finalize_jpms_opts
{ {
hadoop_add_param HADOOP_OPTS IgnoreUnrecognizedVMOptions "-XX:+IgnoreUnrecognizedVMOptions" hadoop_add_param HADOOP_OPTS IgnoreUnrecognizedVMOptions "-XX:+IgnoreUnrecognizedVMOptions"
hadoop_add_param HADOOP_OPTS open.java.io "--add-opens=java.base/java.io=ALL-UNNAMED"
hadoop_add_param HADOOP_OPTS open.java.lang "--add-opens=java.base/java.lang=ALL-UNNAMED"
hadoop_add_param HADOOP_OPTS open.java.lang.reflect "--add-opens=java.base/java.lang.reflect=ALL-UNNAMED"
hadoop_add_param HADOOP_OPTS open.java.math "--add-opens=java.base/java.math=ALL-UNNAMED"
hadoop_add_param HADOOP_OPTS open.java.net "--add-opens=java.base/java.net=ALL-UNNAMED"
hadoop_add_param HADOOP_OPTS open.java.text "--add-opens=java.base/java.text=ALL-UNNAMED"
hadoop_add_param HADOOP_OPTS open.java.util "--add-opens=java.base/java.util=ALL-UNNAMED"
hadoop_add_param HADOOP_OPTS open.java.util.concurrent "--add-opens=java.base/java.util.concurrent=ALL-UNNAMED"
hadoop_add_param HADOOP_OPTS open.java.util.zip "--add-opens=java.base/java.util.zip=ALL-UNNAMED" hadoop_add_param HADOOP_OPTS open.java.util.zip "--add-opens=java.base/java.util.zip=ALL-UNNAMED"
hadoop_add_param HADOOP_OPTS open.sun.security.util "--add-opens=java.base/sun.security.util=ALL-UNNAMED" hadoop_add_param HADOOP_OPTS open.sun.security.util "--add-opens=java.base/sun.security.util=ALL-UNNAMED"
hadoop_add_param HADOOP_OPTS open.sun.security.x509 "--add-opens=java.base/sun.security.x509=ALL-UNNAMED" hadoop_add_param HADOOP_OPTS open.sun.security.x509 "--add-opens=java.base/sun.security.x509=ALL-UNNAMED"

View File

@ -233,7 +233,7 @@
<configuration> <configuration>
<reuseForks>false</reuseForks> <reuseForks>false</reuseForks>
<forkedProcessTimeoutInSeconds>900</forkedProcessTimeoutInSeconds> <forkedProcessTimeoutInSeconds>900</forkedProcessTimeoutInSeconds>
<argLine>-Xmx1024m -XX:+HeapDumpOnOutOfMemoryError</argLine> <argLine>${maven-surefire-plugin.argLine} -Xmx1024m -XX:+HeapDumpOnOutOfMemoryError</argLine>
<environmentVariables> <environmentVariables>
<!-- HADOOP_HOME required for tests on Windows to find winutils --> <!-- HADOOP_HOME required for tests on Windows to find winutils -->
<HADOOP_HOME>${hadoop.common.build.dir}</HADOOP_HOME> <HADOOP_HOME>${hadoop.common.build.dir}</HADOOP_HOME>

View File

@ -167,8 +167,19 @@
<enforced.java.version>[${javac.version},)</enforced.java.version> <enforced.java.version>[${javac.version},)</enforced.java.version>
<enforced.maven.version>[3.3.0,)</enforced.maven.version> <enforced.maven.version>[3.3.0,)</enforced.maven.version>
<!-- keep this list sync with
hadoop-common-project/hadoop-common/src/main/bin/hadoop-functions.sh#hadoop_finalize_jpms_opts
-->
<extraJavaTestArgs> <extraJavaTestArgs>
-XX:+IgnoreUnrecognizedVMOptions -XX:+IgnoreUnrecognizedVMOptions
--add-opens=java.base/java.io=ALL-UNNAMED
--add-opens=java.base/java.lang=ALL-UNNAMED
--add-opens=java.base/java.lang.reflect=ALL-UNNAMED
--add-opens=java.base/java.math=ALL-UNNAMED
--add-opens=java.base/java.net=ALL-UNNAMED
--add-opens=java.base/java.text=ALL-UNNAMED
--add-opens=java.base/java.util=ALL-UNNAMED
--add-opens=java.base/java.util.concurrent=ALL-UNNAMED
--add-opens=java.base/java.util.zip=ALL-UNNAMED --add-opens=java.base/java.util.zip=ALL-UNNAMED
--add-opens=java.base/sun.security.util=ALL-UNNAMED --add-opens=java.base/sun.security.util=ALL-UNNAMED
--add-opens=java.base/sun.security.x509=ALL-UNNAMED --add-opens=java.base/sun.security.x509=ALL-UNNAMED

View File

@ -143,7 +143,7 @@
<forkCount>1</forkCount> <forkCount>1</forkCount>
<reuseForks>false</reuseForks> <reuseForks>false</reuseForks>
<forkedProcessTimeoutInSeconds>600</forkedProcessTimeoutInSeconds> <forkedProcessTimeoutInSeconds>600</forkedProcessTimeoutInSeconds>
<argLine>-Xmx1024m</argLine> <argLine>${maven-surefire-plugin.argLine} -Xmx1024m</argLine>
<includes> <includes>
<include>**/Test*.java</include> <include>**/Test*.java</include>
</includes> </includes>

View File

@ -147,7 +147,7 @@
<forkCount>1</forkCount> <forkCount>1</forkCount>
<reuseForks>false</reuseForks> <reuseForks>false</reuseForks>
<forkedProcessTimeoutInSeconds>600</forkedProcessTimeoutInSeconds> <forkedProcessTimeoutInSeconds>600</forkedProcessTimeoutInSeconds>
<argLine>-Xmx1024m</argLine> <argLine>${maven-surefire-plugin.argLine} -Xmx1024m</argLine>
<includes> <includes>
<include>**/Test*.java</include> <include>**/Test*.java</include>
</includes> </includes>

View File

@ -491,6 +491,8 @@
</plugin> </plugin>
<!-- The fork value is deliberately set to 0 to avoid VM crash while running tests <!-- The fork value is deliberately set to 0 to avoid VM crash while running tests
on Jenkins, removing this leads to tests crashing silently due to VM crash --> on Jenkins, removing this leads to tests crashing silently due to VM crash -->
<!-- TODO: we should investigate and address the crash issue and re-enable fork,
otherwise, JPMS args does not take effect -->
<plugin> <plugin>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<configuration> <configuration>