Skip to content
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

[Bug] VM option 'UseG1GC' must be enabled via -XX:+UnlockExperimentalVMOptions in JDK 1.8 #7996

Open
3 tasks done
engineerping opened this issue Apr 1, 2024 · 6 comments
Open
3 tasks done

Comments

@engineerping
Copy link

Before Creating the Bug Report

  • I found a bug, not just asking a question, which should be created in GitHub Discussions.

  • I have searched the GitHub Issues and GitHub Discussions of this repository and believe that this is not a duplicate.

  • I have confirmed that this bug belongs to the current repository, not other repositories of RocketMQ.

Runtime platform environment

OS: ("macOS 14.3.1 (23D60)")

RocketMQ version

branch: (release-5.2.0) version: (5.2.0) Git commit: (0b612ff)

JDK Version

Compiler: ("Oracle JDK 1.8.0_391") OS: ("macOS 14.3.1 (23D60)")

Describe the Bug

while I am creating Rocket MQ on my local by following https://rocketmq.apache.org/docs/quickStart/01quickstart/;
I got failed without any useful information. after reaching, I changed my shell command, the following information was shown:

$ sh ./mqbroker -n localhost:9876 --enable-proxy
Error: VM option 'UseG1GC' is experimental and must be enabled via -XX:+UnlockExperimentalVMOptions.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

So I have updated some commands and raised a PR.

Steps to Reproduce

Just follow the official document
https://rocketmq.apache.org/docs/quickStart/01quickstart/

when JDK 8 is in use, this problem will be reproduced.

What Did You Expect to See?

$ sh ./mqbroker -n localhost:9876 --enable-proxy
Tue Apr 02 00:18:04 HKT 2024 rocketmq-proxy startup successfully

What Did You See Instead?

Error: VM option 'UseG1GC' is experimental and must be enabled via -XX:+UnlockExperimentalVMOptions.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

Additional Context

I have raised a PR to avoid this problem

@engineerping engineerping changed the title [Bug] Bug title [Bug] Use JVM option "-XX:+UseG1GC" must use JVM option "-XX:+UnlockExperimentalVMOption" first Apr 1, 2024
engineerping added a commit to engineerping/rocketmq that referenced this issue Apr 1, 2024
…eG1GC"

For fixing issue apache#7996, I have updated
runbroker.sh
@engineerping engineerping changed the title [Bug] Use JVM option "-XX:+UseG1GC" must use JVM option "-XX:+UnlockExperimentalVMOption" first [Bug] VM option 'UseG1GC' is experimental and must be enabled via -XX:+UnlockExperimentalVMOptions in JDK 1.8 Apr 1, 2024
@engineerping engineerping changed the title [Bug] VM option 'UseG1GC' is experimental and must be enabled via -XX:+UnlockExperimentalVMOptions in JDK 1.8 [Bug] VM option 'UseG1GC' must be enabled via -XX:+UnlockExperimentalVMOptions in JDK 1.8 Apr 1, 2024
@ltamber
Copy link
Contributor

ltamber commented Apr 2, 2024

I can't reproduce it using openjdk version "1.8.0_382", Maybe you are using an older JDK distributions, can you follow the instructions in bin/runbroker.sh to check the JAVA_MAJOR_VERSION.

@engineerping
Copy link
Author

engineerping commented Apr 2, 2024

Thank you for your response, fine, the details are shown below :

  1. After I followed the instructions in bin/runbroker.sh to check the JAVA_MAJOR_VERSION, the result is "8".
image
  1. My JDK version is: Oracle JDK 1.8.0_391, and this is the only version of JDK in my laptop.
image
  1. My OS version is: macOS 14.3.1 (23D60)
image
  1. the errors are shown in the Red box below, once the parameter -XX:+UnlockExperimentalVMOptions was added, the result turned to successful (shown in the Green box below)
image

@ltamber
Copy link
Contributor

ltamber commented Apr 2, 2024

I have tried to reproduce it on M1 Macbook and still had no issues, it might be specific to certain JDK versions ?
image

image

@engineerping
Copy link
Author

Thank you, I will try Oracle JDK 1.8.0_291 on my laptop

@engineerping
Copy link
Author

Yeah, This issue occurs on specific JDK versions:

  1. Running With Oracle JDK 1.8.0_291, there is no problem
image
  1. Running with Oracle JDK 1.8.0_391, this issue was reproduced
image
  1. And my PR https://github.com/apache/rocketmq/pull/7997/files runs well for both Oracle JDK 1.8.0_291 and
    Oracle JDK 1.8.0_391
image image

@caigy
Copy link
Contributor

caigy commented Apr 7, 2024

G1GC is stable and not experimental since jdk 7u4 (https://www.oracle.com/java/technologies/javase/7u4-relnotes.html). IMO the JDK provider should fix it and explain the reason for inconsistency with release notes, maybe G1GC is indeed unstable in that version (but it's rare).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants