sunm2n commented on PR #23390:
URL: https://github.com/apache/kafka/pull/23390#issuecomment-5594492455

   Yes, this specific RocksDB invalid-state check throws 
`TaskCorruptedException` only under EOS. ALOS bypasses that check, although 
other store-opening failures remain possible. The other creation sites I found 
are in regular stream-task paths.
   
   While checking the cleanup ordering, I found a related issue: with a store 
already registered, the inner catch closes the stores, but the outer catch 
tries to flush them again. This throws `IllegalStateException` before 
`startupException` is assigned. As a result, `GlobalStreamThread.start()` 
returns without throwing, and the internal state remains `CREATED`.
   
   This already affected `InvalidOffsetException` before this PR; my earlier 
revision exposed it to `TaskCorruptedException` as well.
   
   I've pushed two commits:
   - The first addresses the inline comments.
   - The second clears the local `stateConsumer` reference after cleanup to 
prevent the second flush, and adds a regression test with an already registered 
store.
   
   I also corrected the existing startup test: equal beginning and end offsets 
meant it skipped restoration polling and exercised the running-thread path 
instead. It now triggers the exception during initialization.
   
   Tests verify that both exception paths propagate the startup failure and 
reach `DEAD`. All 19 `GlobalStreamThreadTest` tests pass locally.
   
   I'd suggest keeping the handling here with this cleanup fix, since moving it 
into the state manager would still require coordinating the subsequent 
thread-level cleanup. Happy to move it if you prefer.


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