frankvicky commented on PR #19269:
URL: https://github.com/apache/kafka/pull/19269#issuecomment-2757028923

   Hi @ableegoldman,
   
   > can you look into adding a test to make sure that the producer does still 
get reset/recreated properly if the producer is reset (eg transaction hits a 
timeout exception) but the StreamThread is not shutting down?
   
   I've investigated the related code and found writing a test for this 
specific scenario challenging.
   
   The main difficulty is that `TaskManager` doesn't control the timeout logic. 
While `TaskManager#handleLostAll` invokes 
`ActiveTaskCreator#reInitializeProducer`, this method only triggers when a 
`TaskMigratedException` occurs. The entire process is managed by `StreamThread`.
   
   The main pain point in writing this test lies in the deeply nested component 
structure: `StreamsProducer` is a member of `ActiveTaskCreator`, which is a 
member of `TaskManager`, which is ultimately controlled by `StreamThread`. When 
using mocks, this multi-layered nesting makes testing extremely complex.
   We typically mock outer components, but this makes it difficult to directly 
access and verify the reset behavior of the inner `StreamsProducer`. 


-- 
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

Reply via email to