Skip to content

"multiple subscribers not supported" when using WebClient exchange #32727

@poutsma

Description

@poutsma

With Jetty Reactive Client 4.0.2+, subscribing to a publisher multiple times results in test timeouts. To get rid of those, we introduced guards against multiple subscriptions in 6.1.4, see #32100, after a suggestion from the Jetty team (see jetty-project/jetty-reactive-httpclient#354 (comment)).

This guard was backported to 6.0.17 (see #32102), and 5.0.3.32 (see #32101). However, it seems that this change is causing issues on 6.0.x (and potentially also 5.3.x) when used in combination with WebClient's exchange method, for instance:

		Mono<String> responseEntityMono = webClient
				.post().uri("http://localhost:8081")
				.exchangeToMono( response -> response.bodyToMono(String.class))

Specifically, this code results in an IllegalStateException thrown here: https://github.com/jetty-project/jetty-reactive-httpclient/blob/3.0.x/src/main/java/org/eclipse/jetty/reactive/client/internal/AbstractSinglePublisher.java#L49.
The error is only logged, and can safely be ignored. However, it does potentially spam the log, so should be fixed.

The cause of this problem is unclear. However, removing the aforementioned guard resolved it. See #32727 (comment)

Since the original issue (#32100) only occurred with Jetty Reactive Client 4.0.2+, it appears that we can remove the guard in 6.0.x (using Jetty Reactive Client 3.0.x) and 5.3.x (JRC 1.1.x), and only keep them in 6.1.x and higher.

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)status: backportedAn issue that has been backported to maintenance branchestype: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions