sunm2n opened a new pull request, #23549:
URL: https://github.com/apache/kafka/pull/23549

   When a thread is interrupted while waiting for task removal, 
`shutdownStateUpdater()` exits before stopping the updater and closing the 
remaining tasks. This can leave state stores and their resources open.
   
     This PR addresses the interrupted-shutdown issue in KAFKA-21070. The 
separate issue where the updater discarded tasks during shutdown was already 
addressed by KAFKA-20721.
   
     This change continues cleanup after an interrupted removal wait. It 
collects completed removal results and drains the tasks left in the updater 
queues. Checking the futures is necessary because a task whose removal 
completed after the interrupted wait is no longer in those queues and can only 
be recovered through its future.
   
     `DefaultStateUpdater.shutdown()` also retries interrupted joins within the 
original timeout. The updater must stop before the caller closes its remaining 
tasks to avoid accessing them concurrently.
   
     An interruption alone does not cause shutdown to throw. Cleanup continues, 
and the calling thread's interrupt status is preserved. Should an interruption 
be reported as an exception after cleanup, or is returning with the interrupt 
status preserved preferable?
   
     ### Testing
   
     After merging upstream trunk:
   
     - `TaskManagerTest`: 179 tests passed
     - `DefaultStateUpdaterTest`: 100 tests passed
     - `StreamThreadTest`: 170 tests passed
     - Checkstyle and Spotless passed
   
     The regression tests cover interrupted cleanup, removal results completed 
after the interrupted wait, and waiting for the updater to stop. Reverting each 
corresponding fix causes its regression test to fail.
   
     For successful late removal results, the test verifies handoff to the task 
registry. For results containing an exception, it verifies dirty close.


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to