jsancio opened a new pull request, #14141: URL: https://github.com/apache/kafka/pull/14141
The KRaft client uses an expiration service to complete FETCH requests that have timed out. This expiration service uses a different thread from the KRaft polling thread. This means that it is unsafe for the expiration service thread to call `tryCompleteFetchRequest`. `tryCompleteFetchRequest` reads and updates a lot of states that is assumed to be only be read and updated from the polling thread. The KRaft client now does not call `tryCompleteFetchRequest` when the FETCH request has expired. It instead will send the FETCH response that was computed when the FETCH request was first handled. This change also fixes a bug where the KRaft client was not sending the FETCH response immediately, if the response contained a diverging epoch or snapshot id. ### 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