Skip to content

Run HTTP/2 stream openers outside lock#2274

Open
pavel-ptashyts wants to merge 1 commit into
AsyncHttpClient:mainfrom
maygemdev:perf/http2-opener-outside-lock
Open

Run HTTP/2 stream openers outside lock#2274
pavel-ptashyts wants to merge 1 commit into
AsyncHttpClient:mainfrom
maygemdev:perf/http2-opener-outside-lock

Conversation

@pavel-ptashyts

Copy link
Copy Markdown
Contributor

Summary

  • reserve HTTP/2 stream slots and dequeue pending openers while holding pendingLock
  • invoke immediate and queued stream-opening callbacks after releasing the lock
  • keep the empty pending-queue release path allocation-free
  • add deterministic concurrency tests for both opener paths

Motivation

Http2ConnectionState invoked stream openers while holding pendingLock. Opening a stream can reach AsyncHandler.onRequestSend, so one slow callback serialized concurrent submissions to the same HTTP/2 connection.

The change preserves the Issue #2160 close/enqueue happens-before relationship and atomic stream-slot accounting. Only callback execution moves outside the monitor.

Validation

  • ./mvnw -pl client -Dtest=org.asynchttpclient.netty.channel.Http2ConnectionStateTest test
    • 49 tests passed
  • ./mvnw -pl client -Dtest='org.asynchttpclient.netty.channel.Http2ConnectionStateTest,org.asynchttpclient.Http2StreamOrphanRegressionTest,org.asynchttpclient.Http2MultiplexBugRegressionTest,org.asynchttpclient.Http2ResidualFixesRegressionTest' test
    • 68 tests passed

The local environment only provides JDK 21. The JDK 11 ./mvnw clean verify gate was not run locally; the repository CI matrix provides JDK 11 coverage.

Attribution

Codex on behalf of Pavel Ptashyts

Reserve HTTP/2 stream slots and dequeue pending openers while holding
pendingLock, then invoke opening callbacks after releasing it. This
prevents a slow opener or onRequestSend callback from serializing other
request submissions while preserving queue and slot accounting.

Add deterministic concurrency tests for immediate and queued openers.

Codex on behalf of Pavel Ptashyts

Co-Authored-By: Codex <codex@openai.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant