Closed
Description
Affects: 6.0.10
I was scheduling a task using @Scheduled(fixedDelay = Long.MAX_VALUE)
in Spring version 6.0.9. The intention was to schedule the task only once. However, after upgrading to version 6.0.10, the application fails to start with the following exception:
java.lang.ArithmeticException: long overflow
at java.base/java.lang.Math.multiplyExact(Math.java:1004)
at java.base/java.time.Duration.toNanos(Duration.java:1250)
at org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler.scheduleWithFixedDelay(ThreadPoolTaskScheduler.java:420)
It seems that the method ThreadPoolTaskScheduler.scheduleWithFixedDelay()
was changed in commit 3415b04, which is referenced by issue #30666. This change modifies the delay time unit from milliseconds to nanoseconds. I suspect that this alteration may be the cause of the exception.