[
https://issues.apache.org/jira/browse/KAFKA-19724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18030008#comment-18030008
]
Mikołaj Bul commented on KAFKA-19724:
-------------------------------------
??I am not sure what guarantees there are that the handler is invoked??
[~mjsax] I haven't found any specific guarantees being mentioned in the docs,
so I would assume it's executed on a best efforts basis.
I agree that exposing a separate API for setting the Java exception handler
would be confusing and a KS specific handler seems like a difficult thing to
implement (I'm not sure what would be a proper behavior that would suit all the
cases). From my perspective not setting such handler and relying on user
supplying his own default handler with
{{Thread.setDefaultUncaughtExceptionHandler()}} seems like a reasonable
solution.
[~fatihcelik]'s PR looks good to me. Thanks guys for your help and cooperation
here :)
> 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)