[ 
https://issues.apache.org/jira/browse/KAFKA-19724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18021744#comment-18021744
 ] 

Matthias J. Sax commented on KAFKA-19724:
-----------------------------------------

While this might work, I am wondering if it's really how we want/need to do it? 
Where does "UnsatisfiedLinkError" happen, and how could we test it properly?

[~mikkolaj] can you clarify if the problem is only missing logging, or also 
that KafkaStreams does not go into ERROR state?

Looking into the code, `run()` first call `initialize()` which has a try-catch 
that covers the whole method, and would set `startupException`, and return 
`null`, what should actually transit the state into PENDING_SHUTDOWN and DEAD, 
and log an error:
{code:java}
log.error("Error happened during initialization of the global state store; this 
thread has shutdown."); {code}
Of course, if the error does not happen inside `initialize()` or we don't 
handle it properly (we catch `Exception` but not `Throwable`) this code won't 
work as expected... Could it be, that catching Throwable instead of Exception 
would be enough to fix the issue? We also catch Throwable in 
`StreamsThread#run()`...

> Global stream thread ignores all exceptions
> -------------------------------------------
>
>                 Key: KAFKA-19724
>                 URL: https://issues.apache.org/jira/browse/KAFKA-19724
>             Project: Kafka
>          Issue Type: Bug
>          Components: streams
>    Affects Versions: 3.4.0
>            Reporter: Mikołaj Bul
>            Assignee: Fatih Celik
>            Priority: Major
>              Labels: beginner, newbie
>
> {{globalStreamThread}} in {{KafkaStreams}} class ignores all exceptions and 
> fails to apply the user-provided {{StreamsUncaughtExceptionHandler}} in:
> {code:java}
> public void setUncaughtExceptionHandler(final StreamsUncaughtExceptionHandler 
> userStreamsUncaughtExceptionHandler)
> {code}
> This can lead to streams being stuck in faulty state after an exception is 
> thrown during their initialization phase (e.g. failure to load the RocksDB 
> native library). The exception isn't logged, so debugging such problem is 
> difficult.
> From my understanding of the {{b62d8b97}} commit message, the following code 
> is unnecessary as the {{globalStreamThread}} can't be replaced and the issue 
> description from KAFKA-12699 doesn't apply to it. Removing it should help.
> {code:java}
> if (globalStreamThread != null) {
>     globalStreamThread.setUncaughtExceptionHandler((t, e) -> { }
>     );
> }
> {code}



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

Reply via email to