[ 
https://issues.apache.org/jira/browse/KAFKA-21586?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Mohammad Reduwan reassigned KAFKA-21586:
----------------------------------------

    Assignee: Mohammad Reduwan

> LoginManager release can block unbounded while holding the class lock 
> affecting other clients
> ---------------------------------------------------------------------------------------------
>
>                 Key: KAFKA-21586
>                 URL: https://issues.apache.org/jira/browse/KAFKA-21586
>             Project: Kafka
>          Issue Type: Bug
>          Components: clients
>            Reporter: Lianet Magrans
>            Assignee: Mohammad Reduwan
>            Priority: Major
>
> LoginManager.release holds the JVM-wide class lock while it closes the 
> {{Login}} 
> ([LoginManager.java#L155-L164|https://github.com/apache/kafka/blob/30a33d5a8bc8c8d6d41516b9e7113dc822b867be/clients/src/main/java/org/apache/kafka/common/security/authenticator/LoginManager.java#L155-L164]).
>  For OAUTHBEARER, ExpiringCredentialRefreshingLogin.close interrupts the 
> refresh thread once, then calls {{join()}} with no timeout 
> ([ExpiringCredentialRefreshingLogin.java#L248-L259|https://github.com/apache/kafka/blob/30a33d5a8bc8c8d6d41516b9e7113dc822b867be/clients/src/main/java/org/apache/kafka/common/security/oauthbearer/internals/expiring/ExpiringCredentialRefreshingLogin.java#L248-L259]).
> The refresh thread exits only if it sees its interrupt flag after one of its 
> own sleeps 
> ([L94-L95|https://github.com/apache/kafka/blob/30a33d5a8bc8c8d6d41516b9e7113dc822b867be/clients/src/main/java/org/apache/kafka/common/security/oauthbearer/internals/expiring/ExpiringCredentialRefreshingLogin.java#L94-L95],
>  
> [L119-L120|https://github.com/apache/kafka/blob/30a33d5a8bc8c8d6d41516b9e7113dc822b867be/clients/src/main/java/org/apache/kafka/common/security/oauthbearer/internals/expiring/ExpiringCredentialRefreshingLogin.java#L119-L120]).
>  If the interrupt arrives during a re-login and the configured 
> {{sasl.login.callback.handler.class}} clears the flag, the thread keeps 
> refreshing forever. For example, the handler might catch the 
> {{InterruptedException}} from a blocking HTTP call and rethrow it wrapped. 
> Then {{join()}} never returns, and {{LoginManager.class}} stays held.
> This would let the client hanging in {{{}close(){}}}. Because 
> {{acquireLoginManager()}} and {{release()}} both take the same lock 
> ([L109|https://github.com/apache/kafka/blob/30a33d5a8bc8c8d6d41516b9e7113dc822b867be/clients/src/main/java/org/apache/kafka/common/security/authenticator/LoginManager.java#L109],
>  
> [L155|https://github.com/apache/kafka/blob/30a33d5a8bc8c8d6d41516b9e7113dc822b867be/clients/src/main/java/org/apache/kafka/common/security/authenticator/LoginManager.java#L155]),
>  creating or closing any other SASL client in the JVM blocks too.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to