Skip to content

Commit

Permalink
[FLINK-32290][dist] Enable -XX:+IgnoreUnrecognizedVMOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
zentol committed Jun 15, 2023
1 parent 8bf30a1 commit c0dab74
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 4 deletions.
1 change: 1 addition & 0 deletions .mvn/jvm.config
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-XX:+IgnoreUnrecognizedVMOptions
2 changes: 1 addition & 1 deletion flink-dist/src/main/flink-bin/bin/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ if [ -z "${FLINK_ENV_JAVA_OPTS}" ]; then
fi

# Remove leading and ending double quotes (if present) of value
FLINK_ENV_JAVA_OPTS="$( echo "${FLINK_ENV_JAVA_OPTS}" | sed -e 's/^"//' -e 's/"$//' )"
FLINK_ENV_JAVA_OPTS="-XX:+IgnoreUnrecognizedVMOptions $( echo "${FLINK_ENV_JAVA_OPTS}" | sed -e 's/^"//' -e 's/"$//' )"
fi

if [ -z "${FLINK_ENV_JAVA_OPTS_JM}" ]; then
Expand Down
4 changes: 2 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,8 @@ 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] + jvm_opts + log_settings \
+ ["-cp", classpath, program_args.main_class] + program_args.other_args
command = [java_executable, jvm_args, "-XX:+IgnoreUnrecognizedVMOptions"] + 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
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ public void startProcess() throws IOException {
"-Xmx" + jvmMemoryInMb + "m",
"-classpath",
getCurrentClasspath(),
"-XX:+IgnoreUnrecognizedVMOptions",
getEntryPointClassName()
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public TestProcessBuilder(String mainClass) throws IOException {
jvmArgs.add("-Dlog4j.configurationFile=file:" + tempLogFile.getAbsolutePath());
jvmArgs.add("-classpath");
jvmArgs.add(getCurrentClasspath());
jvmArgs.add("-XX:+IgnoreUnrecognizedVMOptions");

this.mainClass = mainClass;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@
public class YarnClusterDescriptor implements ClusterDescriptor<ApplicationId> {
private static final Logger LOG = LoggerFactory.getLogger(YarnClusterDescriptor.class);

@VisibleForTesting
static final String IGNORE_UNRECOGNIZED_VM_OPTIONS = "-XX:+IgnoreUnrecognizedVMOptions";

private final YarnConfiguration yarnConfiguration;

private final YarnClient yarnClient;
Expand Down Expand Up @@ -1808,6 +1811,8 @@ ContainerLaunchContext setupApplicationMasterContainer(
javaOpts += " " + flinkConfiguration.getString(CoreOptions.FLINK_JM_JVM_OPTIONS);
}

javaOpts += " " + IGNORE_UNRECOGNIZED_VM_OPTIONS;

// krb5.conf file will be available as local resource in JM/TM container
if (hasKrb5) {
javaOpts += " -Djava.security.krb5.conf=krb5.conf";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,13 @@ void testSetupApplicationMasterContainer() {
.get(0))
.isEqualTo(
String.join(
" ", java, jvmmem, mainClass, dynamicParameters, redirects));
" ",
java,
jvmmem,
YarnClusterDescriptor.IGNORE_UNRECOGNIZED_VM_OPTIONS,
mainClass,
dynamicParameters,
redirects));

assertThat(
clusterDescriptor
Expand All @@ -217,6 +223,7 @@ void testSetupApplicationMasterContainer() {
" ",
java,
jvmmem,
YarnClusterDescriptor.IGNORE_UNRECOGNIZED_VM_OPTIONS,
krb5,
mainClass,
dynamicParameters,
Expand All @@ -237,6 +244,7 @@ void testSetupApplicationMasterContainer() {
" ",
java,
jvmmem,
YarnClusterDescriptor.IGNORE_UNRECOGNIZED_VM_OPTIONS,
logfile,
logback,
mainClass,
Expand All @@ -257,6 +265,7 @@ void testSetupApplicationMasterContainer() {
" ",
java,
jvmmem,
YarnClusterDescriptor.IGNORE_UNRECOGNIZED_VM_OPTIONS,
krb5,
logfile,
logback,
Expand All @@ -279,6 +288,7 @@ void testSetupApplicationMasterContainer() {
" ",
java,
jvmmem,
YarnClusterDescriptor.IGNORE_UNRECOGNIZED_VM_OPTIONS,
logfile,
log4j,
mainClass,
Expand All @@ -299,6 +309,7 @@ void testSetupApplicationMasterContainer() {
" ",
java,
jvmmem,
YarnClusterDescriptor.IGNORE_UNRECOGNIZED_VM_OPTIONS,
krb5,
logfile,
log4j,
Expand All @@ -321,6 +332,7 @@ void testSetupApplicationMasterContainer() {
" ",
java,
jvmmem,
YarnClusterDescriptor.IGNORE_UNRECOGNIZED_VM_OPTIONS,
logfile,
logback,
mainClass,
Expand All @@ -341,6 +353,7 @@ void testSetupApplicationMasterContainer() {
" ",
java,
jvmmem,
YarnClusterDescriptor.IGNORE_UNRECOGNIZED_VM_OPTIONS,
krb5,
logfile,
logback,
Expand Down Expand Up @@ -369,6 +382,7 @@ void testSetupApplicationMasterContainer() {
java,
jvmmem,
jvmOpts,
YarnClusterDescriptor.IGNORE_UNRECOGNIZED_VM_OPTIONS,
logfile,
logback,
mainClass,
Expand All @@ -390,6 +404,7 @@ void testSetupApplicationMasterContainer() {
java,
jvmmem,
jvmOpts,
YarnClusterDescriptor.IGNORE_UNRECOGNIZED_VM_OPTIONS,
krb5,
logfile,
logback,
Expand Down Expand Up @@ -417,6 +432,7 @@ void testSetupApplicationMasterContainer() {
jvmmem,
jvmOpts,
jmJvmOpts,
YarnClusterDescriptor.IGNORE_UNRECOGNIZED_VM_OPTIONS,
logfile,
log4j,
mainClass,
Expand All @@ -439,6 +455,7 @@ void testSetupApplicationMasterContainer() {
jvmmem,
jvmOpts,
jmJvmOpts,
YarnClusterDescriptor.IGNORE_UNRECOGNIZED_VM_OPTIONS,
krb5,
logfile,
log4j,
Expand Down Expand Up @@ -470,6 +487,7 @@ void testSetupApplicationMasterContainer() {
"2",
jvmOpts,
jmJvmOpts,
YarnClusterDescriptor.IGNORE_UNRECOGNIZED_VM_OPTIONS,
krb5,
"3",
logfile,
Expand Down Expand Up @@ -503,6 +521,7 @@ void testSetupApplicationMasterContainer() {
logback,
jvmOpts,
jmJvmOpts,
YarnClusterDescriptor.IGNORE_UNRECOGNIZED_VM_OPTIONS,
krb5,
jvmmem,
mainClass,
Expand Down

0 comments on commit c0dab74

Please sign in to comment.