This is an automated email from the ASF dual-hosted git repository.
nicholasjiang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/celeborn.git
The following commit(s) were added to refs/heads/main by this push:
new 84830d9fc [CELEBORN-2304] Fix timeout unit mismatch in disk monitor
check
84830d9fc is described below
commit 84830d9fcfe1067c050774d8f21a121b4b22911a
Author: sychen <[email protected]>
AuthorDate: Thu Apr 9 08:24:21 2026 +0800
[CELEBORN-2304] Fix timeout unit mismatch in disk monitor check
### What changes were proposed in this pull request?
Changed tryWithTimeoutAndCallback and tryFutureWithTimeoutAndCallback in
Utils.scala to accept timeout in milliseconds instead of seconds.
### Why are the changes needed?
WORKER_DEVICE_STATUS_CHECK_TIMEOUT is configured in milliseconds (e.g. 30s
→ 30000), but was passed directly to Future.get(..., TimeUnit.SECONDS)
https://github.com/apache/celeborn/blob/7f1bac3443f191d2bc5dcebebb88cd1744b53cd7/common/src/main/scala/org/apache/celeborn/common/CelebornConf.scala#L4100-L4107
https://github.com/apache/celeborn/blob/7f1bac3443f191d2bc5dcebebb88cd1744b53cd7/worker/src/main/scala/org/apache/celeborn/service/deploy/worker/storage/DeviceMonitor.scala#L287-L291
### Does this PR resolve a correctness bug?
No
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
GHA
Closes #3656 from cxzl25/CELEBORN-2304.
Authored-by: sychen <[email protected]>
Signed-off-by: SteNicholas <[email protected]>
---
.../main/scala/org/apache/celeborn/common/util/Utils.scala | 12 ++++++------
.../service/deploy/worker/storage/DeviceMonitorSuite.scala | 2 +-
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/common/src/main/scala/org/apache/celeborn/common/util/Utils.scala
b/common/src/main/scala/org/apache/celeborn/common/util/Utils.scala
index 184e39eec..c193c3f04 100644
--- a/common/src/main/scala/org/apache/celeborn/common/util/Utils.scala
+++ b/common/src/main/scala/org/apache/celeborn/common/util/Utils.scala
@@ -1011,18 +1011,18 @@ object Utils extends Logging {
* @param block the normal action block
* @param callback callback if timeout
* @param threadPool thread pool to submit
- * @param timeoutInSeconds timeout limit value in seconds
+ * @param timeoutMs timeout limit value in milliseconds
* @param errorMessage error message to log exception
* @tparam T result type
* @return result
*/
def tryWithTimeoutAndCallback[T](block: => T)(callback: => T)(
threadPool: ThreadPoolExecutor,
- timeoutInSeconds: Long = 10,
+ timeoutMs: Long = 10000,
errorMessage: String = "none"): T = {
tryFutureWithTimeoutAndCallback(callback)(
future(block)(threadPool),
- timeoutInSeconds,
+ timeoutMs,
errorMessage)
}
@@ -1049,17 +1049,17 @@ object Utils extends Logging {
*
* @param callback callback if timeout
* @param future future to try with timeout and callback
- * @param timeoutInSeconds timeout limit value in seconds
+ * @param timeoutMs timeout limit value in milliseconds
* @param errorMessage error message to log exception
* @tparam T result type
* @return result
*/
def tryFutureWithTimeoutAndCallback[T](callback: => T)(
future: java.util.concurrent.Future[T],
- timeoutInSeconds: Long = 10,
+ timeoutMs: Long = 10000,
errorMessage: String = "none"): T = {
try {
- future.get(timeoutInSeconds, TimeUnit.SECONDS)
+ future.get(timeoutMs, TimeUnit.MILLISECONDS)
} catch {
case _: TimeoutException =>
logError(s"TimeoutException in thread
${Thread.currentThread().getName}," +
diff --git
a/worker/src/test/scala/org/apache/celeborn/service/deploy/worker/storage/DeviceMonitorSuite.scala
b/worker/src/test/scala/org/apache/celeborn/service/deploy/worker/storage/DeviceMonitorSuite.scala
index 7a8e996ae..27dbadd78 100644
---
a/worker/src/test/scala/org/apache/celeborn/service/deploy/worker/storage/DeviceMonitorSuite.scala
+++
b/worker/src/test/scala/org/apache/celeborn/service/deploy/worker/storage/DeviceMonitorSuite.scala
@@ -373,7 +373,7 @@ class DeviceMonitorSuite extends AnyFunSuite {
0 until 3 foreach (i => {
val result = Utils.tryWithTimeoutAndCallback({
fn(i)
- })(false)(pool, 1)
+ })(false)(pool, 1000)
assert(!result)
})
pool.shutdownNow()