On Mon, 20 Feb 2023 19:48:19 GMT, Daniel Fuchs <[email protected]> wrote:

> This fix revisits an assertion that has been observed failing in 
> ResponseSubscribers.HttpResponseInputStream.
> 
> The HttpResponseInputStream has the logic to wait until a buffer has been 
> taken out of the queue before requesting a new one. Therefore there should at 
> most be one byte buffer in the queue, except in the case of error (or 
> asychronous close), where a LAST_LIST sentinel is inserted in the queue to 
> unblock the consumer of the input stream, which might be blocked in 
> queue.take().
> 
> The  HttpResponseInputStream thus asserts, when processing a subscription, 
> that the remaining capacity of the queue should be greater than 1 (unless 
> already closed), to ensure that there will be room for the LAST_LIST 
> sentinel. However, in case of asynchronous shutdown of the executor, it's 
> possible that the subscriber will be marked failed and the LAST_LIST sentinel 
> inserted into the queue before/at the same time that the subscription is 
> processed.
> 
> This fix proposes to relax the assertion to only fire if closed == false and 
> failed == null and capacity <= 1 when processing the subscription

This pull request has now been integrated.

Changeset: 57548480
Author:    Daniel Fuchs <[email protected]>
URL:       
https://git.openjdk.org/jdk/commit/575484806ce11634d4fa8bef6c0c5987e4e0a1c7
Stats:     52 lines in 6 files changed: 19 ins; 16 del; 17 mod

8299338: AssertionError in 
ResponseSubscribers$HttpResponseInputStream::onSubscribe

Reviewed-by: jpai

-------------

PR: https://git.openjdk.org/jdk/pull/12677

Reply via email to