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


##########
hugegraph-store/hg-store-dist/src/assembly/static/bin/start-hugegraph-store.sh:
##########
@@ -169,7 +169,18 @@ if [ "$JAVA_OPTIONS" = "" ]; then
              >> ${OUTPUT}
         exit 1
     fi
-     JAVA_OPTIONS="-Xms${MIN_MEM}m -Xmx${XMX}m -XX:MetaspaceSize=256M 
-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${LOGS} ${USER_OPTION} "
+    # Cap direct memory at the heap size picked here, the JVM's own unset 
default, so the
+    # RocksDB auto-sizing (RocksdbMemoryBudget) counts a limit the JVM 
actually enforces.
+    # Leave it out when -j sets the heap or the cap itself: a fixed cap from 
the computed
+    # heap would no longer match a -j -Xmx, and the JVM then defaults it to 
that heap.
+    DIRECT_MEMORY_OPTION="-XX:MaxDirectMemorySize=${XMX}m"

Review Comment:
   The unquoted cases are fixed, but this remains incomplete for JVM-valid 
quoted option tokens. At [lines 
186–188](https://github.com/apache/hugegraph/blob/7fdd54ab79e6ba8e205caed512d768cf3ec03562/hugegraph-store/hg-store-dist/src/assembly/static/bin/start-hugegraph-store.sh#L186-L188),
 shell word splitting retains quote characters, so a whole quoted 
-XX:MaxDirectMemorySize=64m token in either JAVA_TOOL_OPTIONS or 
JDK_JAVA_OPTIONS does not match the guard.
   
   An isolated exact-source launcher fixture with calc_xmx=1024 still emits 
-XX:MaxDirectMemorySize=1024m. On dots OpenJDK 21.0.12.1, bounded -Xms16m 
-Xmx32m -XX:+PrintFlagsFinal -version checks confirmed 67108864 without that 
generated flag, but 1073741824 with it. Both single- and double-quoted tokens 
reproduce in both variables (four cases), while both unquoted controls preserve 
64 MiB. This verifies a raised effective limit, not actual direct-memory 
allocation or OOM; no Store process or stress test was run, and Java17 runtime 
behavior was not independently tested.
   
   Please account for JVM option quoting without eval and add these 
quoted-token regressions. The existing 20 launcher fixture cases and 11 
entrypoint fixture cases passed. This is a narrow remaining case, not a request 
to redesign the memory budget mechanism.



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