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


##########
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:
   Fixed in 527cfdd6c, without eval. The launcher now strips every single and 
double quote from `JAVA_TOOL_OPTIONS` and `JDK_JAVA_OPTIONS`, as the JVM does 
anywhere in a token, and turns tabs and newlines into spaces. It then matches ` 
-XX:MaxDirectMemorySize=` at a token start with a single `case`, so nothing is 
word-split or globbed. A false match, such as that text inside a quoted `-D` 
value, only leaves the cap to the JVM, whose default is the same heap the 
launcher picked. New launcher cases cover a single- and a double-quoted token 
in each variable, an inner quote (`-XX:"MaxDirectMemorySize"=64m`) and a tab 
separator; a control `-Dt=-XX:MaxDirectMemorySize=64m` still gets the default 
cap. All 27 cases pass on bash 3.2 and 5.3, and the five quoted cases fail 
against the previous launcher. On JDK 17, all three quoted forms give 64 MiB 
without the launcher flag and 1 GiB with it, matching your OpenJDK 21 result.



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