kamalcph commented on code in PR #20045: URL: https://github.com/apache/kafka/pull/20045#discussion_r2185284298
########## core/src/main/scala/kafka/server/DelayedRemoteFetch.scala: ########## @@ -90,8 +92,13 @@ class DelayedRemoteFetch(remoteFetchTask: Future[Void], override def onExpiration(): Unit = { // cancel the remote storage read task, if it has not been executed yet and // avoid interrupting the task if it is already running as it may force closing opened/cached resources as transaction index. - val cancelled = remoteFetchTask.cancel(false) - if (!cancelled) debug(s"Remote fetch task for RemoteStorageFetchInfo: $remoteFetchInfo could not be cancelled and its isDone value is ${remoteFetchTask.isDone}") + remoteFetchTasks.forEach { (topicIdPartition, task) => + if (!task.isDone) { Review Comment: should we add a null check? The task can be null when thread-pool throws RejectedExecutionException in ReplicaManager#processRemoteFetch. ``` if (task != null && !task.isDone) ``` -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org