[ 
https://issues.apache.org/jira/browse/KAFKA-21070?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18114996#comment-18114996
 ] 

이선민 commented on KAFKA-21070:
-----------------------------

I investigated Bug 1 against trunk and added a regression test in 
TaskManagerTest.
  
Bug 2 appears to be the issue addressed by KAFKA-20721: 
StateUpdaterThread.run() now calls
failRemainingTasks()/failPendingActions() instead of discarding tasks.
  
Bug 1 is still present. If the calling thread is interrupted while a removal 
future is incomplete,
waitForFuture() restores the interrupt flag and throws IllegalStateException. 
This aborts
shutdownStateUpdater() and skips the remaining TaskManager cleanup. An 
already-completed future can
return normally with the flag set, so the test uses an incomplete removal 
future.
  
I have an initial prototype. I propose handling interrupted removal waits 
within shutdownStateUpdater(),
ensuring that cleanup accounts for tasks already collected locally, tasks 
returned by removal futures
whose results have not yet been consumed, and tasks remaining in the updater’s 
queues.

The updater must also finish stopping before its remaining tasks are closed. 
Its current shutdown() can
return early when join() is interrupted. I propose retrying that wait within 
the original timeout budget
and restoring the interrupt status afterward, including when another interrupt 
arrives during the wait.
  
Does this shutdown-specific approach make sense? Also, after cleanup completes, 
should an interruption
be propagated as an exception, or should shutdown return with the interrupt 
status preserved?

> KafkaStreams StateUpdater Task Handle Leak on Unclean Shutdown
> --------------------------------------------------------------
>
>                 Key: KAFKA-21070
>                 URL: https://issues.apache.org/jira/browse/KAFKA-21070
>             Project: Kafka
>          Issue Type: Bug
>          Components: streams
>    Affects Versions: 3.9.0, 3.9.1, 3.9.2
>            Reporter: guwensheng
>            Assignee: 이선민
>            Priority: Critical
>             Fix For: 4.5.0, 4.4.1
>
>         Attachments: KAFKA-STREAMS-StateUpdater-Handle-Leak-Bug-Report.md
>
>
>  [^KAFKA-STREAMS-StateUpdater-Handle-Leak-Bug-Report.md] 



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

Reply via email to