Skip to content

Commit 7a164fd

Browse files
authored
Correct drainPendingOpeners javadoc and document SETTINGS-raise test scope (#2295)
Motivation: The offerPendingOpener javadoc claims drainPendingOpeners "only re-offers" a queued opener on a draining connection, which it never does, and the SETTINGS-raise test does not record what it pins. Modification: Reword the javadoc: the opener stays queued because tryAcquireStream refuses once draining/closed. Comment raisedLimitDrainsMultiplePendingOpenersInOrder with its scope and the sibling test for slot accounting. Result: Comments only, no behaviour change.
1 parent 4f855bb commit 7a164fd

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

client/src/main/java/org/asynchttpclient/netty/channel/Http2ConnectionState.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,10 @@ public boolean offerPendingOpener(Runnable opener) {
123123
* {@link #releaseStream()}. Returns {@code false} — <em>without</em> queuing — when the connection is
124124
* already draining or closed, or when the pending queue is already at {@link #MAX_PENDING_OPENERS}: in
125125
* each case the caller MUST fail the request itself rather than let it sit until the request timeout fires
126-
* (Issue #2160). A draining/closed connection never runs a queued opener ({@link #drainPendingOpeners} only
127-
* re-offers it, and {@link #failPendingOpeners} has already drained the queue); a full queue means the peer
128-
* is starving slots and the request would otherwise grow heap without bound.
126+
* (Issue #2160). A draining/closed connection never runs a queued opener ({@link #drainPendingOpeners} leaves
127+
* it queued, since {@link #tryAcquireStream()} refuses once draining/closed, and {@link #failPendingOpeners}
128+
* has already drained the queue); a full queue means the peer is starving slots and the request would
129+
* otherwise grow heap without bound.
129130
* <p>
130131
* Race-free against {@link #failPendingOpeners}: that method sets {@code closed} and drains the queue under
131132
* {@code pendingLock}. An opener enqueued before the drain runs is caught by the drain; an enqueue attempt

client/src/test/java/org/asynchttpclient/netty/channel/Http2ConnectionStateTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,9 @@ public void queuedOpenerRunsOutsidePendingLock() throws Exception {
330330

331331
@Test
332332
public void raisedLimitDrainsMultiplePendingOpenersInOrder() {
333+
// Pins the SETTINGS-raise wakeup: every freed slot is drained in one pass, not just the first (a
334+
// missed-wakeup here is the Issue #2160 silent-timeout class). Slot accounting on a throwing opener
335+
// is covered separately by throwingBatchOpenerLeavesRemainingQueueDrainable.
333336
Http2ConnectionState state = new Http2ConnectionState();
334337
state.updateMaxConcurrentStreams(1);
335338
assertTrue(state.tryAcquireStream());

0 commit comments

Comments
 (0)