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

bugfix: fix startup failure of Server1.5.2 by using OpenJDK 11 #4874

Merged
merged 19 commits into from
Nov 5, 2022

Conversation

robynron
Copy link
Contributor

  • I have registered the PR changes.

Ⅰ. Describe what this PR did

解决在OpenJDK 11环境,seata-server.sh获取jdk版本问题

Ⅱ. Does this pull request fix one issue?

fixes #4849

Ⅲ. Why don't you add test cases (unit test/integration test)?

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

@funky-eyes
Copy link
Contributor

#4434 这个pr里改动了启动脚本,可以识别出jdk17,在jdk11上可以通用吗

fix seata_server.sh
@robynron robynron force-pushed the dev/fix_seata_server.sh branch from 6a1e738 to f8b029e Compare August 19, 2022 04:51
@robynron
Copy link
Contributor Author

JAVA_MAJOR_VERSION=$($JAVACMD -version 2>&1 | sed '1!d' | sed -e 's/"//g' | awk '{print $3}' | awk -F '.' '{print $2}')
if [[ "$JAVA_MAJOR_VERSION" -ge "0" ]] ; then
  JAVA_MAJOR_VERSION=$($JAVACMD -version 2>&1 | sed '1!d' | sed -e 's/"//g' | awk '{print $3}' | awk -F '.' '{print $1}')
fi

可以的,你这里需要完善一下,这里脚本可能无法识别类似于1.8.0_322这样的版本号

@funky-eyes
Copy link
Contributor

或许你来统一做好oraclejdk和openjdk的解析,然后先合并你的,我再合并你的代码,这样我那块就不用改动了

@codecov-commenter
Copy link

codecov-commenter commented Aug 29, 2022

Codecov Report

Merging #4874 (7650389) into develop (0e03695) will decrease coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@              Coverage Diff              @@
##             develop    #4874      +/-   ##
=============================================
- Coverage      49.46%   49.44%   -0.02%     
+ Complexity      4126     4123       -3     
=============================================
  Files            733      733              
  Lines          26051    26051              
  Branches        3219     3219              
=============================================
- Hits           12885    12880       -5     
- Misses         11791    11793       +2     
- Partials        1375     1378       +3     
Impacted Files Coverage Δ
...n/src/main/java/io/seata/common/util/IdWorker.java 77.08% <0.00%> (-6.25%) ⬇️
...in/java/io/seata/server/session/GlobalSession.java 78.68% <0.00%> (-0.78%) ⬇️
...erver/storage/file/session/FileSessionManager.java 49.04% <0.00%> (-0.64%) ⬇️
...very/registry/zk/ZookeeperRegisterServiceImpl.java 61.76% <0.00%> (+0.73%) ⬆️

@robynron
Copy link
Contributor Author

或许你来统一做好oraclejdk和openjdk的解析,然后先合并你的,我再合并你的代码,这样我那块就不用改动了

我测试了下,.sh应该没什么问题,.bat我这边按照你提的pr改的,我这边没法测试,暂时没其他改动。

if [[ "$JAVA_MAJOR_VERSION" -ge "9" ]] ; then
JAVA_OPT="${JAVA_OPT} -Xlog:gc*:file=${BASEDIR}/logs/seata_gc.log:time,tags:filecount=10,filesize=102400"
else
JAVA_OPT="${JAVA_OPT} -Xloggc:${BASEDIR}/logs/seata_gc.log -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=100M"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我建议不要用cms任何参数,不要使用cmsgc

@funky-eyes funky-eyes added this to the 1.6.0 milestone Oct 17, 2022
@robynron robynron changed the title [bugfix] 解决OpenJDK 11 Server1.5.2 启动失败 bugfix: fix startup failure of Server1.5.2 by using OpenJDK 11 Oct 18, 2022
Copy link
Contributor

@funky-eyes funky-eyes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -128,11 +128,16 @@ JVM_MaxMetaspaceSize=$JVM_MaxMetaspaceSize
JVM_MaxDirectMemorySize=$JVM_MaxDirectMemorySize
LOADER_PATH=$LOADER_PATH
JAVA_OPT="${JAVA_OPT} -server -Dloader.path=${LOADER_PATH:="../lib"} -Xmx${JVM_XMX:="2048m"} -Xms${JVM_XMS:="2048m"} -Xmn${JVM_XMN:="1024m"} -Xss${JVM_XSS:="512k"} -XX:SurvivorRatio=10 -XX:MetaspaceSize=${JVM_MetaspaceSize:="128m"} -XX:MaxMetaspaceSize=${JVM_MaxMetaspaceSize:="256m"} -XX:MaxDirectMemorySize=${JVM_MaxDirectMemorySize:=1024m} -XX:-OmitStackTraceInFastThrow -XX:-UseAdaptiveSizePolicy"
JAVA_OPT="${JAVA_OPT} -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${BASEDIR}/logs/java_heapdump.hprof -XX:+DisableExplicitGC -XX:+CMSParallelRemarkEnabled -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=75"
JAVA_OPT="${JAVA_OPT} -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${BASEDIR}/logs/java_heapdump.hprof -XX:+DisableExplicitGC"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove the CMS parameter? What are the GC types and default parameters for different JDK versions?


为什么去掉CMS参数,不同的JDK版本对应的GC类型和默认参数是啥?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gc类型应该交给jdk默认或者用户侧指定,通过${JAVA_OPT}
@slievrly

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docker image should be out of the box.

@xuehanxin
Copy link

问题依旧存在

@funky-eyes
Copy link
Contributor

问题依旧存在

什么问题依然存在,截个图看下

Copy link
Contributor

@wangliang181230 wangliang181230 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@funky-eyes funky-eyes merged commit 73e729f into apache:develop Nov 5, 2022
zw201913 pushed a commit to zw201913/seata that referenced this pull request Nov 7, 2022
* '1103' of https://github.com/zw201913/seata:
  optimize: remove useless code (apache#5047)
  bugfix: fix startup failure of Server1.5.2 by using OpenJDK 11 (apache#4874)
  bugfix: insert value is all parsed as string in insert on duplicate  (apache#5028)
  bugfix: global session is not change to Committed in saga mode (apache#5050)
Copy link
Member

@slievrly slievrly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

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

Successfully merging this pull request may close these issues.

OpenJDK 11 Server1.5.2 启动失败, Error: Could not create the Java Virtual Machine.
6 participants