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

Chris Egerton commented on KAFKA-8304:
--------------------------------------

Looks like performing REST extension initialization in a separate thread is not 
the right approach. If an extension aims to restrict the REST API for security 
reasons, it's possible that a blocking call to 
{{ConnectClusterState.connectors()}} would prevent the extension from 
registering any relevant filters between the time that the REST server starts 
and when the CLI (standalone or distributed) invokes 
{{HerderProvider.setHerder(...)}}.

It also appears that, due to the nature of the code changes to support the new 
integration testing harness, providing a {{Herder}} instance to 
{{ConnectClusterStateImpl}} instances before they're passed to REST may not be 
possible at all, or at least not without considerable refactoring.

> Connect susceptible to deadlock while registering REST extensions
> -----------------------------------------------------------------
>
>                 Key: KAFKA-8304
>                 URL: https://issues.apache.org/jira/browse/KAFKA-8304
>             Project: Kafka
>          Issue Type: Bug
>          Components: KafkaConnect
>    Affects Versions: 2.2.0, 2.1.1, 2.0.2, 2.3.0, 2.1.2, 2.2.1
>            Reporter: Chris Egerton
>            Assignee: Chris Egerton
>            Priority: Blocker
>
> As part of KAFKA-7503, the {{ConnectClusterStateImpl}} class was altered to 
> use a {{HerderProvider}} instance instead of a {{Herder}}. However, the 
> Connect {{RestServer}} registers REST extensions before a herder is given to 
> that {{HerderProvider}}, so any extensions that invoke, e.g., 
> {{ConnectClusterState.connector()}} in their {{register(...)}} method end up 
> in a deadlock that eventually causes Connect startup to fail with the error 
> message "Timed out waiting for herder to be initialized."
> If possible, the {{HerderProvider}} used for {{ConnectClusterStateImpl}} 
> instances given to REST extensions should be supplied with a {{Herder}} 
> before those extensions are registered. If that isn't feasible, another 
> option could be to install Connect REST extensions on a separate thread so 
> that they don't block the Connect startup process and eventual call of 
> {{HerderProvider.setHerder(...)}}.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to