New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GG-36475 Fix the illegal reflective access warnings issue #3070
base: master
Are you sure you want to change the base?
Conversation
Take a look at the file /bin/include/jvmdefaults.sh. I think most of the options have to be moved there |
@iakkuratov added the jvm options to jvmdefaults.sh and corresponding changes in control.sh. |
@iakkuratov please review the changes. |
Undid the commits that added a wrong file name. Cleaned up the empty lines. |
bin/controlsh
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file should not exist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed.
bin/control.sh
Outdated
CONTROL_JVM_OPTS="${CONTROL_JVM_OPTS} --add-exports=java.base/jdk.internal.misc=ALL-UNNAMED" | ||
CONTROL_JVM_OPTS="${CONTROL_JVM_OPTS} --add-exports=java.base/sun.nio.ch=ALL-UNNAMED" | ||
CONTROL_JVM_OPTS="${CONTROL_JVM_OPTS} --add-opens=java.base/jdk.internal.misc=ALL-UNNAMED" | ||
CONTROL_JVM_OPTS="${CONTROL_JVM_OPTS} --add-opens=java.base/sun.nio.ch=ALL-UNNAMED" | ||
CONTROL_JVM_OPTS="${CONTROL_JVM_OPTS} --add-opens=java.base/sun.nio.ch=ALL-UNNAMED" | ||
CONTROL_JVM_OPTS="${CONTROL_JVM_OPTS} --add-opens=java.management/com.sun.jmx.mbeanserver=ALL-UNNAMED" | ||
CONTROL_JVM_OPTS="${CONTROL_JVM_OPTS} --add-opens=jdk.internal.jvmstat/sun.jvmstat.monitor=ALL-UNNAMED" | ||
CONTROL_JVM_OPTS="${CONTROL_JVM_OPTS} --add-opens=java.base/sun.reflect.generics.reflectiveObjects=ALL-UNNAMED" | ||
CONTROL_JVM_OPTS="${CONTROL_JVM_OPTS} --add-opens=jdk.management/com.sun.management.internal=ALL-UNNAMED" | ||
CONTROL_JVM_OPTS="${CONTROL_JVM_OPTS} --add-opens=java.base/java.io=ALL-UNNAMED" | ||
CONTROL_JVM_OPTS="${CONTROL_JVM_OPTS} --add-opens=java.base/java.nio=ALL-UNNAMED" | ||
CONTROL_JVM_OPTS="${CONTROL_JVM_OPTS} --add-opens=java.base/java.util=ALL-UNNAMED" | ||
CONTROL_JVM_OPTS="${CONTROL_JVM_OPTS} --add-opens=java.base/java.lang=ALL-UNNAMED" | ||
CONTROL_JVM_OPTS="${CONTROL_JVM_OPTS} --illegal-access=warn" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I get it right this changes have to be reverted since you moved options to a separate file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Please double-check spaces before strings and feel free to proceed with the core review.
bin/control.sh
Outdated
@@ -40,12 +40,19 @@ fi | |||
# Set SCRIPTS_HOME - base path to scripts. | |||
# | |||
SCRIPTS_HOME="${IGNITE_HOME_TMP}/bin" | |||
. "${SCRIPTS_HOME}"/include/functions.sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am a bit confused about this change. IMHO, we need to add additional JVM options to the CONTROL_JVM_OPTS
variable. Something like as follows:
CONTROL_JVM_OPTS=$(getJavaSpecificOptsForControlScript $version "$CONTROL_JVM_OPTS")
where getJavaSpecificOptsForControlScript
should determine the required options based on the JVM version like the getJavaSpecificOpts
does.
By the way, this fix should be applied to the control.bat
script as well. Perhaps, it makes sense to update snapshot-utility
scripts in the same way. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have updated control.sh
to use getJavaSpecificOpts
for handling Java version-specific options. Based on your suggestion, are there additional requirements or different needs for control.sh
that require a separate function? If getJavaSpecificOpts
isn't suitable for this script, I agree that creating a new function, getJavaSpecificOptsForControlScript
, could ensure we handle all specific settings effectively. I'll proceed with this approach if it matches your observations. And yes the changes we make to control.sh
should also be applied to control.bat
and potentially the snapshot-utility
scripts to ensure uniform behavior across our toolset.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I got your point right, you propose updating getJavaSpecificOpts
instead of introducing a specific method for control.sh
. Well, the idea looks good at first glance.
bin/control.sh
Outdated
@@ -112,7 +119,7 @@ fi | |||
# Assertions are disabled by default since version 3.5. | |||
# If you want to enable them - set 'ENABLE_ASSERTIONS' flag to '1'. | |||
# | |||
ENABLE_ASSERTIONS="1" | |||
ENABLE_ASSERTIONS="0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
bin/control.sh
Outdated
-DIGNITE_UPDATE_NOTIFIER=false -DIGNITE_HOME="${IGNITE_HOME}" \ | ||
$(getIbmSslOpts $version) \ | ||
-DIGNITE_HOME="${IGNITE_HOME}" \ | ||
-Dcom.ibm.jsse2.overrideDefaultTLS=true -Dssl.KeyManagerFactory.algorithm=IbmX509 \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please clarify why this change is needed? I would say that using $(getIbmSslOpts $version)
is the right way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right that maintaining dynamic handling of SSL options through getIbmSslOpts
is more flexible and maintainable, especially as it adapts to different Java versions. The hardcoded SSL options were used during simplified testing, which I should have clarified. I will revert this change to restore the use of getIbmSslOpts
to ensure that our configuration remains robust and adaptable to various environments.
bin/include/jvmdefaults.sh
Outdated
@@ -103,3 +103,9 @@ getJavaSpecificOpts() { | |||
|
|||
echo $value | |||
} | |||
# Reflective access options | |||
addReflectiveAccessOptions() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the exact list of options should be based on the JVM version. For example, using these opts with JVM8 leads to
Unrecognized option: --add-exports=java.base/jdk.internal.misc=ALL-UNNAMED
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
Perhaps, I am missing something.
It would be nice to check the script works as expected using Java 8, 11, and 17
https://www.gridgain.com/docs/latest/getting-started/quick-start/java
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for highlighting the compatibility issues with Java 8. I realize now that my updates to the jvmdefaults.sh script included Java 9+ specific options without checks for Java version compatibility. I will revise the script to dynamically adjust the JVM options based on the version it detects.
Yes as recommended I will also conduct testing across these Java versions to confirm that the script functions correctly in each environment.
Once you've confirmed my approach regarding the initial comment of the PR, I will make all necessary changes and conduct all tests at once.
…ibility and address warnings
Made changes based on above discussion. Included |
By adding some JVM parameters in bin/control.sh, the issue of "illegal reflective access warnings" was addressed.