zhuyufeng created FLINK-28065:
---------------------------------
Summary: A never reached code in ProcessMemoryUtils Class
Key: FLINK-28065
URL: https://issues.apache.org/jira/browse/FLINK-28065
Project: Flink
Issue Type: Bug
Components: Runtime / Configuration
Affects Versions: 1.16.0
Reporter: zhuyufeng
The main logic of *sanityCheckTotalProcessMemory* method in ProcessMemoryUtils
Class will {color:#FF0000}never be executed{color}.
this is reason:
In *deriveJvmMetaspaceAndOverheadFromTotalFlinkMemory* method of
ProcessMemoryUtils Class, the
[logic|https://github.com/apache/flink/blob/master/flink-runtime/src/main/java/org/apache/flink/runtime/util/config/memory/ProcessMemoryUtils.java#L170]
determines whether TotalProcessMemory is explicitly configured.
In "false" branch(means TotalProcessMemory is not explicitly configured), the
[logic|https://github.com/apache/flink/blob/master/flink-runtime/src/main/java/org/apache/flink/runtime/util/config/memory/ProcessMemoryUtils.java#L184]
calls the *sanityCheckTotalProcessMemory* method.
However, the main logic of *sanityCheckTotalProcessMemory* method only executed
[when TotalProcessMemory is explicitly
configured|https://github.com/apache/flink/blob/master/flink-runtime/src/main/java/org/apache/flink/runtime/util/config/memory/ProcessMemoryUtils.java#L247],
so the main logic probably never be executed.
Compare with [call
location|https://github.com/apache/flink/blob/master/flink-runtime/src/main/java/org/apache/flink/runtime/util/config/memory/taskmanager/TaskExecutorFlinkMemoryUtils.java#L101]
of *sanityCheckTotalFlinkMemory* method(this method is similar to the logic of
the *sanityCheckTotalProcessMemory* method in that it compares whether the
derived memory size is consistent with the explicitly configured memory size)
in TaskExecutorFlinkMemoryUtils Class, i guess *sanityCheckTotalProcessMemory*
method should be called behind "if" branch, not in the "if" branch.
--
This message was sent by Atlassian Jira
(v8.20.7#820007)