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


##########
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:
   ⚠️ Important: This default also overrides a limit supplied in 
`JAVA_TOOL_OPTIONS` or `JDK_JAVA_OPTIONS`, because JVM environment options are 
processed before command-line flags. For example, 
`JAVA_TOOL_OPTIONS=-XX:MaxDirectMemorySize=512m` with the generated 
`-XX:MaxDirectMemorySize=2g` results in a 2 GiB cap (confirmed with 
`-XX:+PrintFlagsFinal`). An existing deployment using that environment cap can 
therefore allocate more direct memory after upgrading and exceed its container 
limit. Please preserve an explicit environment-provided cap and add a launcher 
regression case for it.



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