Matthias Pohl created FLINK-34022:
-------------------------------------

             Summary: A Duration that cannot be expressed as long in 
nanoseconds causes an ArithmeticException in TimeUtils.formatWithHighestUnit
                 Key: FLINK-34022
                 URL: https://issues.apache.org/jira/browse/FLINK-34022
             Project: Flink
          Issue Type: Bug
          Components: Runtime / Configuration
    Affects Versions: 1.17.2, 1.18.0, 1.19.0
            Reporter: Matthias Pohl


The following code fails with an {{ArithmeticException}} because of the actual 
timeframe not being able to be converted into a long value:
{code:java}
TimeUtils.formatWithHighestUnit(Duration.ofMillis(Long.MAX_VALUE));
{code}

This method is used to pretty-print Duration values and most often used with 
configuration values. We might want to have a reasonable fallback instead of 
throwing a {{RuntimeException}} here.

E.g. it can cause the error in the 
[ClusterConfigHandler|https://github.com/apache/flink/blob/ebdde651edae8db6b2ac740f07d97124dc01fea4/flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/cluster/ClusterConfigHandler.java#L56]
 if a Duration-based configuration parameter is set too high (e.g. 
[JobManagerOptions.RESOURCE_WAIT_TIMEOUT|https://github.com/apache/flink/blob/3ff225c5f993282d6dfc7726fc08cc00058d9a7f/flink-core/src/main/java/org/apache/flink/configuration/JobManagerOptions.java#L540]).



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to