Skip to content

Fix flaky vertx http2NoConnectionLeak test by using h2c prior knowledge - #3385

Merged
velo merged 1 commit into
masterfrom
feature/fix-vertx-http2-leak-test
Jun 3, 2026
Merged

Fix flaky vertx http2NoConnectionLeak test by using h2c prior knowledge#3385
velo merged 1 commit into
masterfrom
feature/fix-vertx-http2-leak-test

Conversation

@velo

@velo velo commented Jun 3, 2026

Copy link
Copy Markdown
Member

feign.vertx.ConnectionsLeakTests.http2NoConnectionLeak has been flaky on CI (e.g. failed on #3384), asserting Expected size: 1 but was: 2 open server connections.

Root cause

The test fires 100 concurrent requests over an HTTP/2 pool capped at one connection (PoolOptions.setHttp2MaxSize(1)) and asserts the server saw exactly one connection.

By default vertx negotiates cleartext HTTP/2 via an HTTP/1.1 Upgrade (HttpClientOptions.DEFAULT_HTTP2_CLEAR_TEXT_UPGRADE = true). During that handshake the connection is still HTTP/1.1, so the pool applies http1MaxSize (default 5) instead of http2MaxSize (1). Under CI load the upgrade window is wide enough that a second connection is opened before the first finishes upgrading to HTTP/2, so the server records 2 connections. (DEFAULT_MAX_CONCURRENT_STREAMS is effectively unlimited, so stream multiplexing is not the issue.) It surfaced after the recent vertx 5.1.0 bump because the full pr-build suite only runs on PRs.

Fix

Connect with h2c prior knowledge (setHttp2ClearTextUpgrade(false)): the connection is HTTP/2 from the first byte, so http2MaxSize(1) deterministically caps it at one connection and the 100 requests multiplex over it. Applied to both the feign-vertx test (run against vertx 5.x via feign-vertx5-test) and the feign-vertx4-test copy.

Validation

ConnectionsLeakTests (both HTTP/1.1 and HTTP/2) passes locally under vertx 5.1.0 (5/5 runs) and vertx 4.5.27.

Signed-off-by: Marvin Froeder <velo.br@gmail.com>
@velo
velo merged commit c5dc1dd into master Jun 3, 2026
4 checks passed
@velo
velo deleted the feature/fix-vertx-http2-leak-test branch June 3, 2026 16:35
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