Matthias J. Sax created KAFKA-21103:
---------------------------------------

             Summary: Kafka Streams might loose a thread unnoticed
                 Key: KAFKA-21103
                 URL: https://issues.apache.org/jira/browse/KAFKA-21103
             Project: Kafka
          Issue Type: Bug
          Components: streams
            Reporter: Matthias J. Sax


KS allows to register an uncaught-exception-handler, which has a REPLACE_THREAD 
return code.

However, it's possible that starting up the new thread fails, and such an error 
is swallowed silently, letting the user think the thread was restarted even if 
it was not.

This is especially bad for single-threaded clients, which would stay in state 
RUNNING and not transitioning into DEAD or ERROR.

A known workaround is to inspect IQ metadata – when the thread dies, it's 
correctly removed there.

In `KafkaStreams#replaceStreamThread()` we call `addStreamsThread()` but ignore 
it's returned Optional. We should check if the Optional is empty or not, and 
either retry, or somehow surface the error otherwise (throwing an exception 
might also work, which we would need to catch elsewhere, and re-triggering the 
handler?)

Depending how we want to fix this, a KIP might be needed?



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

Reply via email to