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


##########
hugegraph-server/hugegraph-dist/src/assembly/static/bin/hugegraph-server.sh:
##########
@@ -121,13 +121,41 @@ 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. The
+# defaults go first in JAVA_TOOL_OPTIONS, which the JVM reads before the 
operator's
+# own JAVA_TOOL_OPTIONS, JDK_JAVA_OPTIONS, the command line (JAVA_OPTIONS and 
-j)
+# and _JAVA_OPTIONS, so any of those overrides them. The JVM does that parsing
+# itself, including quoted options and @argfiles.
+# 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 carry the launch time 
plus
+# a counter that skips names already used in $LOGS. The script execs java 
below,
+# so $$ is the JVM's PID.
+crash_files_exist() {
+    local file
+    for file in "${LOGS}"/java_pid*_"$1".hprof "${LOGS}"/hs_err_pid*_"$1".log; 
do
+        [[ -e ${file} ]] && return 0
+    done
+    return 1
+}
+LAUNCH_STAMP=$(date +%Y%m%d-%H%M%S)
+LAUNCH_ID="${LAUNCH_STAMP}"
+LAUNCH_SUFFIX=0
+while crash_files_exist "${LAUNCH_ID}"; do

Review Comment:
   ⚠️ Blocking: no. Summary: If multiple Server pods share one log PVC, 
simultaneous launches can select the same crash-file names. Evidence: the 
second-resolution stamp and existence check at lines 147-153 do not reserve the 
ID, while the generated paths use only namespace-local PIDs at lines 155-156. 
Please add a per-pod unique component or atomically reserve the launch ID.



##########
docker/README.md:
##########
@@ -230,6 +230,12 @@ Standalone stores RocksDB data at 
`/hugegraph-server/rocksdb-data`. The HStore t
 
 `docker compose down` keeps named-volume data. `docker compose down -v` 
intentionally deletes it.
 
+### Server logs and crash files
+
+Both Server images (`hugegraph/hugegraph` and `hugegraph/server`) write the 
HugeGraph log to container stdout. WARN and above from Hadoop, ZooKeeper, SOFA, 
Netty and Commons also reaches stdout; their INFO output, the audit log and the 
slow-query log stay in files only. When a Server exits during startup, `docker 
logs` or `kubectl logs --previous` shows why.

Review Comment:
   🧹 Blocking: no. Summary: This sentence overstates what container logs expose 
for failures before Java starts. Evidence: at this head, the JDK/version and 
heap-capacity error branches append only to `${OUTPUT}` 
(`hugegraph-server.sh:111-114,121-122`); `STDOUT_MODE` routes the launched JVM 
to container stdout at `:289-299`. Please narrow this claim to JVM/bootstrap 
failures or emit these preflight errors to stderr.



-- 
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