Skip to content

Commit cc81e63

Browse files
authored
Add official support and validation for Vert.x 5.1 and 5.2 (#50886)
* Add official support and validation for Vert.x 5.1 and 5.2 * Update versions * Use baseline of Java 11 in version override tests
1 parent c578d1a commit cc81e63

10 files changed

Lines changed: 122 additions & 15 deletions

File tree

‎common/perf-test-core/pom.xml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
<includes combine.children="append">
5656
<!-- Special allowance for performance libraries as they aren't shipped. -->
5757
<include>com.beust:jcommander:[1.82]</include> <!-- {x-include-update;com.beust:jcommander;external_dependency} -->
58-
<include>io.vertx:vertx-codegen:[4.5.32]</include> <!-- {x-include-update;io.vertx:vertx-codegen;external_dependency} -->
58+
<include>io.vertx:vertx-codegen:[4.5.35]</include> <!-- {x-include-update;io.vertx:vertx-codegen;external_dependency} -->
5959
<include>io.projectreactor:reactor-core:[3.8.7]</include> <!-- {x-include-update;io.projectreactor:reactor-core;external_dependency} -->
6060
</includes>
6161
</bannedDependencies>
@@ -94,7 +94,7 @@
9494
<dependency>
9595
<groupId>io.vertx</groupId>
9696
<artifactId>vertx-codegen</artifactId>
97-
<version>4.5.32</version> <!-- {x-version-update;io.vertx:vertx-codegen;external_dependency} -->
97+
<version>4.5.35</version> <!-- {x-version-update;io.vertx:vertx-codegen;external_dependency} -->
9898
<scope>provided</scope>
9999
</dependency>
100100
<dependency>

‎eng/versioning/external_dependencies.txt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ io.netty:netty-transport-native-unix-common;4.2.19.Final
6363
io.netty:netty-transport-native-kqueue;4.2.19.Final
6464
io.projectreactor.netty:reactor-netty-http;1.3.7
6565
io.projectreactor:reactor-core;3.8.7
66-
io.vertx:vertx-codegen;4.5.32
67-
io.vertx:vertx-core;4.5.32
66+
io.vertx:vertx-codegen;4.5.35
67+
io.vertx:vertx-core;4.5.35
6868
javax.websocket:javax.websocket-api;1.1
6969
org.apache.ant:ant;1.10.18
7070
org.apache.arrow:arrow-format;19.0.0

‎eng/versioning/supported_external_dependency_versions.json‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,20 @@
195195
{ "io.projectreactor:reactor-core": "3.4.15" },
196196
{ "io.projectreactor:reactor-test": "3.4.15" }
197197
],
198+
"vertx_4.5": [
199+
{ "io.vertx:vertx-codegen": "4.5.0" },
200+
{ "io.vertx:vertx-core": "4.5.0" }
201+
],
198202
"vertx_5.0": [
199203
{ "io.vertx:vertx-codegen": "5.0.0" },
200204
{ "io.vertx:vertx-core": "5.0.0" }
205+
],
206+
"vertx_5.1": [
207+
{ "io.vertx:vertx-codegen": "5.1.0" },
208+
{ "io.vertx:vertx-core": "5.1.0" }
209+
],
210+
"vertx_5.2": [
211+
{ "io.vertx:vertx-codegen": "5.2.0" },
212+
{ "io.vertx:vertx-core": "5.2.0" }
201213
]
202214
}

‎sdk/core/azure-core-http-vertx/CHANGELOG.md‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,25 @@
44

55
### Features Added
66

7+
- Added support for Vert.x 5.1 and 5.2 while retaining compatibility with Vert.x 4.5 and 5.0.
8+
79
### Breaking Changes
810

911
### Bugs Fixed
1012

1113
- Fixed a bug where requests with a streaming body, such as `Flux<ByteBuffer>` or `InputStream`, would never be sent
1214
when running with Vert.x 5.x.
13-
- Fixed response timeouts and request cancellation leaving HTTP exchanges active and occupying pooled connections.
15+
- Fixed response timeouts and request cancellation leaving HTTP exchanges active and occupying pooled connections,
16+
including reset failures caused by incompatible method return types in Vert.x 5.x.
1417
- Fixed the SDK write timeout continuing to run after writing completed, incorrectly terminating slow responses.
1518
- Fixed excessive retention of canceled write-timeout tasks during streamed uploads with many small buffers.
1619

1720
### Other Changes
1821

22+
#### Dependency Updates
23+
24+
- Upgraded `vertx-codegen` and `vertx-core` from `4.5.32` to `4.5.35`.
25+
1926
## 1.2.0 (2026-09-29)
2027

2128
### Features Added

‎sdk/core/azure-core-http-vertx/README.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ Azure Core Vert.x HTTP client is a plugin for the `azure-core` HTTP client API.
1111

1212
### Include the package
1313

14-
By default, this transport uses Vert.x 4.5 and Netty 4.1 to support Java 8. It also supports Vert.x 5.0 on Java 11 or
15-
later when your application selects Vert.x 5.0 and its compatible transitive dependencies, including Netty 4.2.
14+
By default, this transport uses Vert.x 4.5 and Netty 4.1 to support Java 8. It also supports Vert.x 5.0, 5.1, and 5.2
15+
on Java 11 or later when your application selects one of these Vert.x versions and its compatible transitive
16+
dependencies, including Netty 4.2.
1617
Keep Vert.x and Netty versions consistent across your application. Do not combine the default Vert.x 4.5/Netty 4.1
1718
dependencies with the Netty 4.2-based `azure-core-http-netty` library on the same classpath.
1819

‎sdk/core/azure-core-http-vertx/pom.xml‎

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,14 @@
8282
<dependency>
8383
<groupId>io.vertx</groupId>
8484
<artifactId>vertx-codegen</artifactId>
85-
<version>4.5.32</version> <!-- {x-version-update;io.vertx:vertx-codegen;external_dependency} -->
85+
<version>4.5.35</version> <!-- {x-version-update;io.vertx:vertx-codegen;external_dependency} -->
8686
<scope>provided</scope>
8787
</dependency>
8888

8989
<dependency>
9090
<groupId>io.vertx</groupId>
9191
<artifactId>vertx-core</artifactId>
92-
<version>4.5.32</version> <!-- {x-version-update;io.vertx:vertx-core;external_dependency} -->
92+
<version>4.5.35</version> <!-- {x-version-update;io.vertx:vertx-core;external_dependency} -->
9393
</dependency>
9494

9595
<!-- test dependencies on azure-core, because we want to run tests inherited from this module using Vert.x Web Client -->
@@ -172,13 +172,52 @@
172172
<rules>
173173
<bannedDependencies>
174174
<includes>
175-
<include>io.vertx:vertx-codegen:[4.5.32]</include> <!-- {x-include-update;io.vertx:vertx-codegen;external_dependency} -->
176-
<include>io.vertx:vertx-core:[4.5.32]</include> <!-- {x-include-update;io.vertx:vertx-core;external_dependency} -->
175+
<include>io.vertx:vertx-codegen:[4.5.35]</include> <!-- {x-include-update;io.vertx:vertx-codegen;external_dependency} -->
176+
<include>io.vertx:vertx-core:[4.5.35]</include> <!-- {x-include-update;io.vertx:vertx-core;external_dependency} -->
177177
</includes>
178178
</bannedDependencies>
179179
</rules>
180180
</configuration>
181181
</plugin>
182182
</plugins>
183183
</build>
184+
185+
<profiles>
186+
<!-- Vert.x dependency overrides may require Java 11. Normal builds retain the Java 8 baseline. -->
187+
<profile>
188+
<id>version-override-tests</id>
189+
<activation>
190+
<property>
191+
<name>env.VERSION_OVERRIDE_TESTS</name>
192+
<value>true</value>
193+
</property>
194+
</activation>
195+
<build>
196+
<plugins>
197+
<plugin>
198+
<groupId>org.apache.maven.plugins</groupId>
199+
<artifactId>maven-compiler-plugin</artifactId>
200+
<version>3.15.0</version> <!-- {x-version-update;org.apache.maven.plugins:maven-compiler-plugin;external_dependency} -->
201+
<executions>
202+
<execution>
203+
<id>base-compile</id>
204+
<configuration>
205+
<release>11</release>
206+
<!-- Include module-info.java so Java 11 compilation resolves dependencies on the module path. -->
207+
<excludes combine.self="override"/>
208+
</configuration>
209+
</execution>
210+
<execution>
211+
<id>base-testCompile</id>
212+
<configuration>
213+
<release>11</release>
214+
<testRelease>11</testRelease>
215+
</configuration>
216+
</execution>
217+
</executions>
218+
</plugin>
219+
</plugins>
220+
</build>
221+
</profile>
222+
</profiles>
184223
</project>

‎sdk/core/azure-core-http-vertx/src/main/java/com/azure/core/http/vertx/VertxHttpClient.java‎

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,24 @@ class VertxHttpClient implements HttpClient {
6464
private static final Duration EXPECT_CONTINUE_TIMEOUT = Duration.ofSeconds(1);
6565

6666
private static final ReflectiveInvoker REQUEST_RESET;
67+
private static final ReflectiveInvoker REQUEST_WRITE_HEAD;
6768
static {
6869
// In order to support both Vert.x 4.5 and 5.x reflection is needed to reset an HttpClientRequest.
6970
// HttpClientRequest.reset(long, Throwable) is available in both versions, but it returns boolean in 4.5 and
7071
// Future<Void> in 5.x, so a call compiled against one version fails with NoSuchMethodError on the other.
7172
try {
7273
Method method = HttpClientRequest.class.getMethod("reset", long.class, Throwable.class);
7374
REQUEST_RESET = ReflectionUtils.getMethodInvoker(HttpClientRequest.class, method, false);
75+
76+
// Vert.x 5.1 introduced writeHead() and deprecated sendHead() for removal. Resolve the appropriate method
77+
// at runtime so the transport can still be compiled and used with Vert.x 4.5 and 5.0.
78+
Method writeHeadMethod;
79+
try {
80+
writeHeadMethod = HttpClientRequest.class.getMethod("writeHead");
81+
} catch (NoSuchMethodException ex) {
82+
writeHeadMethod = HttpClientRequest.class.getMethod("sendHead");
83+
}
84+
REQUEST_WRITE_HEAD = ReflectionUtils.getMethodInvoker(HttpClientRequest.class, writeHeadMethod, false);
7485
} catch (Exception ex) {
7586
// Fail here as the method isn't available and this HttpClient wouldn't be usable anyway.
7687
throw LOGGER.logExceptionAsError(new IllegalStateException(ex));
@@ -288,7 +299,7 @@ private void sendBody(ContextView contextView, HttpRequest azureRequest, Progres
288299
writeOnce.run();
289300
});
290301
long headerWrite = writeWatcher.start();
291-
vertxRequest.sendHead().onSuccess(ignored -> writeWatcher.pause(headerWrite)).onFailure(promise::tryFail);
302+
writeHead(vertxRequest).onSuccess(ignored -> writeWatcher.pause(headerWrite)).onFailure(promise::tryFail);
292303
} else {
293304
writeBody(contextView, azureRequest, progressReporter, vertxRequest, promise, body, writeWatcher);
294305
}
@@ -339,6 +350,15 @@ private void writeBody(ContextView contextView, HttpRequest azureRequest, Progre
339350
}
340351
}
341352

353+
@SuppressWarnings("unchecked")
354+
private static Future<Void> writeHead(HttpClientRequest vertxRequest) {
355+
try {
356+
return (Future<Void>) REQUEST_WRITE_HEAD.invokeWithArguments(vertxRequest);
357+
} catch (Exception ex) {
358+
return Future.failedFuture(ex);
359+
}
360+
}
361+
342362
private static void resetRequest(HttpClientRequest vertxRequest, long code, Throwable cause) {
343363
try {
344364
REQUEST_RESET.invokeWithArguments(vertxRequest, code, cause);

‎sdk/core/azure-core-http-vertx/src/test/java/com/azure/core/http/vertx/VertxHttpClientTimeoutTests.java‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,31 @@ public void cancelledRequestReleasesConnection(boolean bufferingResponse) throws
9696
}
9797
}
9898

99+
@Test
100+
public void cancelledUploadCancelsBodyAndReleasesConnection() throws Exception {
101+
try (TimeoutTestServer server = new TimeoutTestServer()) {
102+
CompletableFuture<Void> cancelled = new CompletableFuture<>();
103+
HttpRequest request = server.request("/hang")
104+
.setHttpMethod(HttpMethod.POST)
105+
.setBody(Flux.just(ByteBuffer.wrap(new byte[] { 1 }))
106+
.concatWith(Flux.never())
107+
.doOnCancel(() -> cancelled.complete(null)));
108+
HttpClient client = server.client(Duration.ZERO);
109+
CompletableFuture<HttpResponse> pending = client.send(request).toFuture();
110+
111+
try {
112+
assertNotNull(server.received.get(TEST_TIMEOUT.toMillis(), TimeUnit.MILLISECONDS));
113+
assertFalse(pending.isDone());
114+
assertTrue(pending.cancel(true));
115+
116+
cancelled.get(TEST_TIMEOUT.toMillis(), TimeUnit.MILLISECONDS);
117+
assertFastRequestSucceeds(client, server);
118+
} finally {
119+
pending.cancel(true);
120+
}
121+
}
122+
}
123+
99124
@Test
100125
public void cancelledQueuedRequestDoesNotHoldConnection() throws Exception {
101126
try (TimeoutTestServer server = new TimeoutTestServer()) {

‎sdk/core/version-overrides-vertx-matrix.json‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@
1919
}
2020
},
2121
"VersionOverride": [
22-
"vertx_5.0"
22+
"vertx_4.5",
23+
"vertx_5.0",
24+
"vertx_5.1",
25+
"vertx_5.2"
2326
]
2427
}
2528
}

‎sdk/template/azure-template-stress/pom.xml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
<dependency>
6060
<groupId>io.vertx</groupId>
6161
<artifactId>vertx-codegen</artifactId>
62-
<version>4.5.32</version> <!-- {x-version-update;io.vertx:vertx-codegen;external_dependency} -->
62+
<version>4.5.35</version> <!-- {x-version-update;io.vertx:vertx-codegen;external_dependency} -->
6363
<scope>provided</scope>
6464
</dependency>
6565
<dependency>
@@ -98,7 +98,7 @@
9898
<include>io.opentelemetry.instrumentation:opentelemetry-runtime-telemetry:[2.31.1-alpha]</include> <!-- {x-include-update;io.opentelemetry.instrumentation:opentelemetry-runtime-telemetry;external_dependency} -->
9999
<include>io.opentelemetry.instrumentation:opentelemetry-logback-appender-1.0:[2.31.1-alpha]</include> <!-- {x-include-update;io.opentelemetry.instrumentation:opentelemetry-logback-appender-1.0;external_dependency} -->
100100
<include>ch.qos.logback:logback-classic:[1.3.14]</include> <!-- {x-include-update;ch.qos.logback:logback-classic;external_dependency} -->
101-
<include>io.vertx:vertx-codegen:[4.5.32]</include> <!-- {x-include-update;io.vertx:vertx-codegen;external_dependency} -->
101+
<include>io.vertx:vertx-codegen:[4.5.35]</include> <!-- {x-include-update;io.vertx:vertx-codegen;external_dependency} -->
102102
</includes>
103103
</bannedDependencies>
104104
</rules>

0 commit comments

Comments
 (0)