elastic / elastic/apm-agent-java
Spring Webflux 3.2: agent attachment causes java.lang.IllegalStateException: The underlying HTTP client completed without emitting a response.
- Dominant language
- Java
- Stars
- 594
- Forks
- 338
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 25
Description
## Describe the bug
Using Spring Boot 3.2.2 Webflux with attached APM agent 1.49.0 on JDK 21.0.3:
```
java.lang.IllegalStateException: The underlying HTTP client completed without emitting a response.
at org.springframework.web.reactive.function.client.DefaultWebClient.lambda$static$0(DefaultWebClient.java:78) ~[spring-webflux-6.1.3.jar!/:6.1.3]
at reactor.core.publisher.MonoErrorSupplied.subscribe(MonoErrorSupplied.java:55) ~[reactor-core-3.6.2.jar!/:3.6.2]
at reactor.core.publisher.Mono.subscribe(Mono.java:4512) ~[reactor-core-3.6.2.jar!/:3.6.2]
at reactor.core.publisher.FluxSwitchIfEmpty$SwitchIfEmptySubscriber.onComplete(FluxSwitchIfEmpty.java:82) ~[reactor-core-3.6.2.jar!/:3.6.2]
at reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onComplete(FluxOnAssembly.java:549) ~[reactor-core-3.6.2.jar!/:3.6.2]
at co.elastic.apm.agent.reactor.TracedSubscriber.onComplete(TracedSubscriber.java:141) ~[na:na]
```
## Steps to reproduce
We don't have a sample test app yet but our findings concluded that the only factor leading to this error is agent jar attachment to java command. Without attachment the application works. **With APM enabled it only fails on Spring Boot 3.2.2 but works fine on Spring Boot 2.7.10**.
Another finding - the application's endpoints are functioning except for ones using [Mono.zip](https://github.com/reactor/reactor-core/blob/main/reactor-core/src/main/java/reactor/core/publisher/Mono.java#L1311)
## Expected behavior
Spring Webflux endpoint works the same way with or without APM.
## Debug logs
See logs attached
[apm.log](https://github.com/elastic/apm-agent-java/files/15044472/apm.log)
Contributor guide
Assessment
This issue has not been assessed yet.