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

ASF GitHub Bot commented on KAFKA-9330:
---------------------------------------

soondenana commented on pull request #7866: KAFKA-9330: Skip `join` when 
`AdminClient.close` is called in callback thread
URL: https://github.com/apache/kafka/pull/7866
 
 
   The close method calls `Thread.join` to wait for AdminClient thread to
   die, but if the close is called in the api completion callback, `join`
   waits forever, as the thread calling `join` is same as the thread it
   wants to wait to die.
   
   This change checks for this condition and skips the join. The thread
   will then return to main loop, where it will check for this condition
   and exit.
   
   Added a new unit test to invoke this condition. The test fails with
   timeout if the thread is joined in callback, passes otherwise.
   
   *More detailed description of your change,
   if necessary. The PR title and PR message become
   the squashed commit message, so use a separate
   comment to ping reviewers.*
   
   *Summary of testing strategy (including rationale)
   for the feature or bug fix. Unit and/or integration
   tests are expected for any behaviour change and
   system tests should be considered for larger changes.*
   
   ### Committer Checklist (excluded from commit message)
   - [ ] Verify design and implementation 
   - [ ] Verify test coverage and CI build status
   - [ ] Verify documentation (including upgrade notes)
   
 
----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Calling AdminClient.close in the AdminClient completion callback causes 
> deadlock
> --------------------------------------------------------------------------------
>
>                 Key: KAFKA-9330
>                 URL: https://issues.apache.org/jira/browse/KAFKA-9330
>             Project: Kafka
>          Issue Type: Bug
>            Reporter: Vikas Singh
>            Assignee: Vikas Singh
>            Priority: Major
>
> The close method calls `Thread.join` to wait for AdminClient thread to die, 
> but that doesn't happen as the thread calling join is the AdminClient thread. 
> This causes the thread to block forever, causing a deadlock where it forever 
> waits for itself to die. 
> `AdminClient.close` should check if the thread calling close is same as 
> current thread, then skip the join. The thread will check for close condition 
> in the main loop and exit.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to