byteayan commented on code in PR #3258:
URL: https://github.com/apache/hugegraph/pull/3258#discussion_r4172497080


##########
hugegraph-server/hugegraph-dist/src/assembly/static/bin/hugegraph-server.sh:
##########
@@ -121,13 +121,43 @@ if [ "$JAVA_OPTIONS" = "" ]; then
         echo "Failed to start HugeGraphServer, requires at least ${MIN_MEM}MB 
free memory" >> "${OUTPUT}"
         exit 1
     fi
-    JAVA_OPTIONS="-Xms${MIN_MEM}m -Xmx${XMX}m -XX:+HeapDumpOnOutOfMemoryError 
-XX:HeapDumpPath=${LOGS} ${USER_OPTION}"
+    JAVA_OPTIONS="-Xms${MIN_MEM}m -Xmx${XMX}m ${USER_OPTION}"
 
     # Rolling out detailed GC logs
     #JAVA_OPTIONS="${JAVA_OPTIONS} -XX:+UseGCLogFileRotation 
-XX:GCLogFileSize=10M -XX:NumberOfGCLogFiles=3 \
     #              -Xloggc:./logs/gc.log -XX:+PrintHeapAtGC 
-XX:+PrintGCDetails -XX:+PrintGCDateStamps"
 fi
 
+# Keep heap dumps and JVM crash logs in $LOGS whatever JAVA_OPTIONS holds. 
They go
+# first so a value from JAVA_OPTIONS, -j or _JAVA_OPTIONS, all later on the 
command
+# line, still wins. JAVA_TOOL_OPTIONS and JDK_JAVA_OPTIONS are read before the 
command
+# line, so a flag set there is left out here instead of being overridden.
+# A restarted container often reuses the JVM's PID, and HotSpot will not 
overwrite an
+# existing crash log or heap dump, so the file names also carry the launch 
time. The
+# script execs java below, so $$ is the JVM's PID.
+LAUNCH_STAMP=$(date +%Y%m%d-%H%M%S)
+CRASH_OPTIONS=""
+SET_HEAP_DUMP="true"
+SET_HEAP_DUMP_PATH="true"
+SET_ERROR_FILE="true"
+for OPTION in ${JAVA_TOOL_OPTIONS:-} ${JDK_JAVA_OPTIONS:-}; do
+    case "${OPTION}" in
+        -XX:[+-]HeapDumpOnOutOfMemoryError) SET_HEAP_DUMP="false" ;;
+        -XX:HeapDumpPath=*) SET_HEAP_DUMP_PATH="false" ;;
+        -XX:ErrorFile=*) SET_ERROR_FILE="false" ;;

Review Comment:
   Fixed in ed28f471: the telemetry block now appends the `-javaagent` option 
to the existing `JAVA_TOOL_OPTIONS` instead of replacing it, so an operator's 
`-XX:ErrorFile` there survives. `test-java-security-properties.sh` covers it 
with a stubbed agent checksum, and the test fails on the previous script.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to