You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "celikfatih (via GitHub)" <gi...@apache.org> on 2025/10/09 08:36:44 UTC

[PR] KAFKA-19724 [kafka]

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

   Kafka streams do not catch Error types that occur during `GlobalStreamThread` initiation, and therefore it is not possible to trace the error (for example, an `ExceptionInInitializerError` occurs when RocksDB is not found for the Global Store). This is because errors are not caught and logged.
   
   The catch block in `GlobalStreamThread#initialize()` has been ensured to catch `Throwable` instead of `Exception`. Additionally, the empty `setUncaughtHandler` set operation that prevented this from taking effect when users employed setUncaughtExceptionHandler has been removed.
   
   For the test scenario;
   It was demonstrated that whenever any `Throwable` occurs, this `Throwable` is correctly wrapped with `StreamsException` and the stream initiation transitions to an `DEAD` state.
   
   @mjsax @cadonna May I ask you to check the changes?


-- 
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-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] KAFKA-19724: Global stream thread should not ignore any exceptions [kafka]

Posted by "mjsax (via GitHub)" <gi...@apache.org>.
mjsax merged PR #20668:
URL: https://github.com/apache/kafka/pull/20668


-- 
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-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] KAFKA-19724: Global stream thread should not ignore any exceptions [kafka]

Posted by "mjsax (via GitHub)" <gi...@apache.org>.
mjsax commented on code in PR #20668:
URL: https://github.com/apache/kafka/pull/20668#discussion_r2430893210


##########
streams/src/main/java/org/apache/kafka/streams/processor/internals/GlobalStreamThread.java:
##########
@@ -431,9 +431,9 @@ private StateConsumer initialize() {
         } catch (final StreamsException fatalException) {
             closeStateConsumer(stateConsumer, false);
             startupException = fatalException;
-        } catch (final Exception fatalException) {
+        } catch (final Throwable throwable) {

Review Comment:
   Nit: it's still fatal, even if we change the type -- in general, we try to use expressive names, and `throwable` is not an improvement over `fatalException` I believe.



##########
streams/src/main/java/org/apache/kafka/streams/processor/internals/GlobalStreamThread.java:
##########
@@ -431,9 +431,9 @@ private StateConsumer initialize() {
         } catch (final StreamsException fatalException) {
             closeStateConsumer(stateConsumer, false);
             startupException = fatalException;
-        } catch (final Exception fatalException) {
+        } catch (final Throwable throwable) {

Review Comment:
   ```suggestion
           } catch (final Throwable fatalException) {
   ```



-- 
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-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] KAFKA-19724: Global stream thread should not ignore any exceptions [kafka]

Posted by "mjsax (via GitHub)" <gi...@apache.org>.
mjsax commented on PR #20668:
URL: https://github.com/apache/kafka/pull/20668#issuecomment-3414307960

   Thanks for the fix! Merged to `trunk` and cherry-picked to `4.1`, `4.0`, and `3.9` branches.


-- 
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-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] KAFKA-19724: Global stream thread should not ignore any exceptions [kafka]

Posted by "celikfatih (via GitHub)" <gi...@apache.org>.
celikfatih commented on code in PR #20668:
URL: https://github.com/apache/kafka/pull/20668#discussion_r2435468841


##########
streams/src/main/java/org/apache/kafka/streams/processor/internals/GlobalStreamThread.java:
##########
@@ -431,9 +431,9 @@ private StateConsumer initialize() {
         } catch (final StreamsException fatalException) {
             closeStateConsumer(stateConsumer, false);
             startupException = fatalException;
-        } catch (final Exception fatalException) {
+        } catch (final Throwable throwable) {

Review Comment:
   You're right, i would change it to `fatalException`.



-- 
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-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] KAFKA-19724: Global stream thread should not ignore any exceptions [kafka]

Posted by "celikfatih (via GitHub)" <gi...@apache.org>.
celikfatih commented on code in PR #20668:
URL: https://github.com/apache/kafka/pull/20668#discussion_r2435468841


##########
streams/src/main/java/org/apache/kafka/streams/processor/internals/GlobalStreamThread.java:
##########
@@ -431,9 +431,9 @@ private StateConsumer initialize() {
         } catch (final StreamsException fatalException) {
             closeStateConsumer(stateConsumer, false);
             startupException = fatalException;
-        } catch (final Exception fatalException) {
+        } catch (final Throwable throwable) {

Review Comment:
   Yo're right, i would change it to `fatalException`.



-- 
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-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org