Skip to content

Commit

Permalink
[FLINK-25002][build] Add java 17 add-opens/add-exports JVM arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
zentol committed Jun 16, 2023
1 parent e323a89 commit 2940c02
Show file tree
Hide file tree
Showing 42 changed files with 327 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .mvn/jvm.config
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
-XX:+IgnoreUnrecognizedVMOptions
--add-exports=java.security.jgss/sun.security.krb5=ALL-UNNAMED
--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED
--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED
--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED
--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
7 changes: 7 additions & 0 deletions flink-clients/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ under the License.

<packaging>jar</packaging>

<properties>
<surefire.module.config><!--
chill ArraysAsListSerializer
-->--add-opens=java.base/java.util=ALL-UNNAMED
</surefire.module.config>
</properties>

<dependencies>

<!-- core dependencies -->
Expand Down
7 changes: 7 additions & 0 deletions flink-connectors/flink-connector-base/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@

<packaging>jar</packaging>

<properties>
<surefire.module.config><!--
chill ArraysAsListSerializer
-->--add-opens=java.base/java.util=ALL-UNNAMED
</surefire.module.config>
</properties>

<!-- Allow users to pass custom connector versions -->
<dependencies>
<dependency>
Expand Down
7 changes: 7 additions & 0 deletions flink-connectors/flink-connector-files/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ under the License.

<packaging>jar</packaging>

<properties>
<surefire.module.config><!--
chill ArraysAsListSerializer
-->--add-opens=java.base/java.util=ALL-UNNAMED
</surefire.module.config>
</properties>

<dependencies>

<!-- core dependencies -->
Expand Down
6 changes: 6 additions & 0 deletions flink-connectors/flink-connector-kafka/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ under the License.

<properties>
<kafka.version>3.2.3</kafka.version>
<surefire.module.config><!--
chill ArraysAsListSerializer
-->--add-opens=java.base/java.util=ALL-UNNAMED <!--
Kryo
-->--add-opens=java.base/java.lang=ALL-UNNAMED
</surefire.module.config>
</properties>

<dependencies>
Expand Down
18 changes: 18 additions & 0 deletions flink-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,24 @@ under the License.

<packaging>jar</packaging>

<properties>
<surefire.module.config> <!--
required by JmxServer
-->--add-exports=java.rmi/sun.rmi.registry=ALL-UNNAMED <!--
PluginConfigTest (CommonTestUtils#setEnv)
-->--add-opens=java.base/java.util=ALL-UNNAMED <!--
ExceptionUtilsTest
-->--add-opens=java.base/java.lang=ALL-UNNAMED <!--
StateDescriptorTest (Kryo serialization of File)
-->--add-opens=java.base/java.io=ALL-UNNAMED <!--
SerializersTest (Kryo serialization of Nested1->Path->URI)
-->--add-opens=java.base/java.net=ALL-UNNAMED <!--
InitOutputPathTest
-->--add-opens=java.base/java.util.concurrent.locks=ALL-UNNAMED <!--
-->--add-opens=java.base/java.lang.reflect=ALL-UNNAMED
</surefire.module.config>
</properties>

<dependencies>
<dependency>
<groupId>org.apache.flink</groupId>
Expand Down
3 changes: 3 additions & 0 deletions flink-dist/src/main/resources/flink-conf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
# limitations under the License.
################################################################################

# These parameters are required for Java 17 support.
# They can be safely removed when using Java 8/11.
env.java.opts.all: --add-exports=java.base/sun.net.util=ALL-UNNAMED --add-exports=java.rmi/sun.rmi.registry=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-exports=java.security.jgss/sun.security.krb5=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.text=ALL-UNNAMED --add-opens=java.base/java.time=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.concurrent.atomic=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.locks=ALL-UNNAMED

#==============================================================================
# Common
Expand Down
3 changes: 3 additions & 0 deletions flink-end-to-end-tests/flink-queryable-state-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>org.apache.flink.streaming.tests.queryablestate.QsStateClient</mainClass>
<manifestEntries>
<Add-Opens>java.base/java.util</Add-Opens>
</manifestEntries>
</transformer>
</transformers>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ function run_local_recovery_test {
TEST_PROGRAM_JAR=${END_TO_END_DIR}/flink-local-recovery-and-allocation-test/target/StickyAllocationAndLocalRecoveryTestJob.jar
# configure for HA
create_ha_config
# required for PID business in StickyAllocationAndLocalRecoveryTestJob
set_config_key env.java.opts.taskmanager "--add-opens=java.management/sun.management=ALL-UNNAMED"

# Enable debug logging
sed -i -e 's/rootLogger.level = .*/rootLogger.level = DEBUG/' "$FLINK_DIR/conf/log4j.properties"
Expand Down
7 changes: 7 additions & 0 deletions flink-examples/flink-examples-table/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ under the License.
<artifactId>flink-examples-table_${scala.binary.version}</artifactId>
<packaging>jar</packaging>

<properties>
<surefire.module.config><!--
chill ArraysAsListSerializer
-->--add-opens=java.base/java.util=ALL-UNNAMED
</surefire.module.config>
</properties>

<dependencies>
<!-- Flink core -->
<dependency>
Expand Down
11 changes: 11 additions & 0 deletions flink-filesystems/flink-hadoop-fs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,17 @@ under the License.

<packaging>jar</packaging>

<properties>
<surefire.module.config><!--
HadoopConfigLoadingTest
-->--add-opens=java.base/java.util=ALL-UNNAMED <!--
HadoopUtilsTest
-->--add-exports=java.security.jgss/sun.security.krb5=ALL-UNNAMED <!--
HadoopDataInputStreamTest
-->--add-opens=java.base/java.io=ALL-UNNAMED
</surefire.module.config>
</properties>

<dependencies>
<dependency>
<groupId>org.apache.flink</groupId>
Expand Down
13 changes: 13 additions & 0 deletions flink-formats/flink-avro/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,19 @@ under the License.

<packaging>jar</packaging>

<properties>
<surefire.module.config><!--
Kryo ByteBuffer
-->--add-opens=java.base/java.nio=ALL-UNNAMED <!--
Kryo LocalDate
-->--add-opens=java.base/java.time=ALL-UNNAMED <!--
Kryo
-->--add-opens=java.base/java.lang=ALL-UNNAMED <!--
chill ArraysAsListSerializer
-->--add-opens=java.base/java.util=ALL-UNNAMED
</surefire.module.config>
</properties>

<dependencies>

<!-- Core -->
Expand Down
7 changes: 7 additions & 0 deletions flink-formats/flink-csv/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ under the License.

<packaging>jar</packaging>

<properties>
<surefire.module.config><!--
chill ArraysAsListSerializer
-->--add-opens=java.base/java.util=ALL-UNNAMED
</surefire.module.config>
</properties>

<dependencies>

<dependency>
Expand Down
7 changes: 7 additions & 0 deletions flink-formats/flink-json/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ under the License.

<packaging>jar</packaging>

<properties>
<surefire.module.config><!--
chill ArraysAsListSerializer
-->--add-opens=java.base/java.util=ALL-UNNAMED
</surefire.module.config>
</properties>

<dependencies>

<dependency>
Expand Down
9 changes: 9 additions & 0 deletions flink-formats/flink-orc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ under the License.

<packaging>jar</packaging>

<properties>
<surefire.module.config><!--
Kryo buffer
-->--add-opens=java.base/java.nio=ALL-UNNAMED <!--
chill ArraysAsListSerializer
-->--add-opens=java.base/java.util=ALL-UNNAMED
</surefire.module.config>
</properties>

<dependencies>

<!-- Core -->
Expand Down
7 changes: 7 additions & 0 deletions flink-formats/flink-parquet/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ under the License.

<packaging>jar</packaging>

<properties>
<surefire.module.config><!--
chill ArraysAsListSerializer
-->--add-opens=java.base/java.util=ALL-UNNAMED
</surefire.module.config>
</properties>

<dependencies>

<!-- Core -->
Expand Down
7 changes: 7 additions & 0 deletions flink-fs-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ under the License.

<packaging>jar</packaging>

<properties>
<surefire.module.config><!--
chill ArraysAsListSerializer
-->--add-opens=java.base/java.util=ALL-UNNAMED
</surefire.module.config>
</properties>

<!--
This is a Hadoop2 only flink module.
-->
Expand Down
9 changes: 9 additions & 0 deletions flink-java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ under the License.

<packaging>jar</packaging>

<properties>
<surefire.module.config> <!--
JoinOperatorTest / chill ArraysAsListSerializer
-->--add-opens=java.base/java.util=ALL-UNNAMED <!--
CollectionInputFormatTest
-->--add-opens=java.base/java.lang=ALL-UNNAMED
</surefire.module.config>
</properties>

<dependencies>
<dependency>
<groupId>org.apache.flink</groupId>
Expand Down
4 changes: 4 additions & 0 deletions flink-kubernetes/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ under the License.

<properties>
<kubernetes.client.version>6.6.2</kubernetes.client.version>
<surefire.module.config><!--
CommonTestUtils#setEnv
-->--add-opens=java.base/java.util=ALL-UNNAMED
</surefire.module.config>
</properties>

<dependencies>
Expand Down
7 changes: 7 additions & 0 deletions flink-libraries/flink-cep/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ under the License.
<name>Flink : Libraries : CEP</name>
<packaging>jar</packaging>

<properties>
<surefire.module.config><!--
chill ArraysAsListSerializer
-->--add-opens=java.base/java.util=ALL-UNNAMED
</surefire.module.config>
</properties>

<dependencies>

<!-- core dependencies -->
Expand Down
9 changes: 9 additions & 0 deletions flink-libraries/flink-state-processing-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@ under the License.

<packaging>jar</packaging>

<properties>
<surefire.module.config><!--
chill ArraysAsListSerializer
-->--add-opens=java.base/java.util=ALL-UNNAMED <!--
Kryo
-->--add-opens=java.base/java.lang=ALL-UNNAMED
</surefire.module.config>
</properties>

<dependencies>

<!-- core dependencies -->
Expand Down
7 changes: 7 additions & 0 deletions flink-metrics/flink-metrics-jmx/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ under the License.
<artifactId>flink-metrics-jmx</artifactId>
<name>Flink : Metrics : JMX</name>

<properties>
<surefire.module.config> <!--
required by JmxServer
-->--add-exports=java.rmi/sun.rmi.registry=ALL-UNNAMED
</surefire.module.config>
</properties>

<dependencies>
<dependency>
<groupId>org.apache.flink</groupId>
Expand Down
9 changes: 9 additions & 0 deletions flink-python/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@ under the License.

<properties>
<arrow.version>5.0.0</arrow.version>
<kafka.version>3.2.3</kafka.version>
<surefire.module.config><!--
CommonTestUtils#setEnv
-->--add-opens=java.base/java.util=ALL-UNNAMED <!--
Kryo AtomicBoolean
-->--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED <!--
Arrow MemoryUtil
-->--add-opens=java.base/java.nio=ALL-UNNAMED
</surefire.module.config>
</properties>

<dependencies>
Expand Down
6 changes: 4 additions & 2 deletions flink-python/pyflink/pyflink_gateway_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,10 @@ def launch_gateway_server_process(env, args):
[construct_flink_classpath(env), construct_hadoop_classpath(env)])
if "FLINK_TESTING" in env:
classpath = os.pathsep.join([classpath, construct_test_classpath()])
command = [java_executable, jvm_args, "-XX:+IgnoreUnrecognizedVMOptions"] + jvm_opts \
+ log_settings + ["-cp", classpath, program_args.main_class] + program_args.other_args
command = [java_executable, jvm_args, "-XX:+IgnoreUnrecognizedVMOptions",
"--add-opens=jdk.proxy2/jdk.proxy2=ALL-UNNAMED"] \
+ jvm_opts + log_settings \
+ ["-cp", classpath, program_args.main_class] + program_args.other_args
else:
command = [os.path.join(env["FLINK_BIN_DIR"], "flink"), "run"] + program_args.other_args \
+ ["-c", program_args.main_class]
Expand Down
7 changes: 7 additions & 0 deletions flink-queryable-state/flink-queryable-state-runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ under the License.
<name>Flink : Queryable state : Runtime</name>
<packaging>jar</packaging>

<properties>
<surefire.module.config><!--
chill ArraysAsListSerializer
-->--add-opens=java.base/java.util=ALL-UNNAMED
</surefire.module.config>
</properties>

<dependencies>

<!-- core dependencies -->
Expand Down
14 changes: 14 additions & 0 deletions flink-runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,20 @@ under the License.

<packaging>jar</packaging>

<properties>
<surefire.module.config><!--
JobManagerProcessUtilsTest
-->--add-opens=java.base/java.util=ALL-UNNAMED <!--
ConnectionUtilsTest
-->--add-opens=java.base/java.lang=ALL-UNNAMED <!--
-->--add-opens=java.base/java.net=ALL-UNNAMED <!--
OperatorStateBackendTest
-->--add-opens=java.base/java.io=ALL-UNNAMED <!--
AsynchronousFileIOChannelTest
-->--add-opens=java.base/java.util.concurrent=ALL-UNNAMED
</surefire.module.config>
</properties>

<dependencies>

<!-- core dependencies -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@ public void startProcess() throws IOException {
cmd = ArrayUtils.addAll(cmd, jvmArgs);
}

final String moduleConfig = System.getProperty("surefire.module.config");
if (moduleConfig != null) {
cmd = ArrayUtils.addAll(cmd, moduleConfig.split(" "));
}

synchronized (createDestroyLock) {
checkState(process == null, "process already started");

Expand Down
Loading

0 comments on commit 2940c02

Please sign in to comment.