ddongjunn opened a new pull request, #24384:
URL: https://github.com/apache/kafka/pull/24384

   ApplicationEventHandler.addAndGet() waited on the event's future with no 
timeout, relying entirely on the background thread (via CompletableEventReaper) 
to complete the future, either with the result or with a TimeoutException once 
the event's deadline passed. If the background thread terminates without 
completing cleanup() - for example when it fails with an OutOfMemoryError - the 
reaper never runs, the future is never completed, and the application thread 
parks in future.get() forever. For AsyncKafkaConsumer.close() this means the 
consumer hangs in leaveGroupOnClose() and never finishes closing.
   
   Bound the wait on the application thread instead of depending on the 
background thread:
   
   - Wait in slices of 100 ms, never past the event's deadline. An event that 
is already past its deadline when the wait starts still gets one slice, so that 
an event the background thread is about to complete is returned rather than 
failed.
   - After each slice, check that the background thread is still alive and fail 
with a KafkaException naming the event when it is not.
   - Return or propagate the event's result as soon as its future is done, so 
an event failed with a TimeoutException is reported to the caller rather than 
being mistaken for the expiration of a wait slice.
   
   The existing pre-enqueue liveness check (KAFKA-18812) only covers the moment 
an event is added; this covers the window in which the application thread is 
already waiting.
   
   Delete this text and replace it with a detailed description of your change. 
The 
   PR title and body will become the squashed commit message.
   
   If you would like to tag individuals, add some commentary, upload images, or
   include other supplemental information that should not be part of the 
eventual
   commit message, please use a separate comment.
   
   If applicable, please include a summary of the testing strategy (including 
   rationale) for the proposed change. Unit and/or integration tests are 
expected
   for any behavior change and system tests should be considered for larger
   changes.
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to