davide-armand opened a new pull request, #18142:
URL: https://github.com/apache/kafka/pull/18142

   The call to `backingStore.get()` (called by connector task threads through 
`OffsetStorageReaderImpl.offsets()`) can block for long time waiting for data 
flush to complete (`KafkaProducer.flush()`).
   
   This change moves that call outside the synchronized clause that holds 
`offsetReadFutures`, so that if `backingStore.get()` hangs then it does not 
keep `offsetReadFutures` locked. The access to `closed` flag (`closed.get()`) 
is kept inside the synchronize clause to avoid race condition with `close()`.
   
   This is important because `OffsetStorageReaderImpl.close()` needs to lock 
`offsetReadFutures` as well in order to cancel the futures.
   Since the herder thread calls `OffsetStorageReaderImpl.close()` when 
attempting to stops a task, before this change this was resulting in the herder 
thread hanging indefinetely waiting for `backingStore.get()` to complete.
   
   
   ### 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.

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to