We have run into a serious issue that was not expected or caught until late
it appears with CXF and Reactor in Undertow (using Spring Boot)...
The Flux throws an exception inside and hangs infinitely, requiring the
process to be forcibly killed (kill -9).
We are using Spring Boot (latest), CXF (latest) with Reactor extension,
Undertow and Reactor. Has anyone run into this and are there or could there
be any potential work around to handle this?
There seems to be a problem with the onComplete handling of Fluxes when it
throws a RuntimeException. Basically, if you try to the endpoint, it will
hang. I've tracked it down to the writeTo function in
StreamingAsyncSubscriber where the queue is empty but "completed" is still
false so it goes into an infinite loop. You can repeat it by running the
code below.
```
@Path("/errors")
@Produces(APPLICATION_JSON)
public Flux<String> errors()
{
Flux<String> response = Flux
.range(1, 5)
.flatMap(item->
{
if (item <=4)
{
return Mono.just("item: " + item);
}
else
{
System.out.println("---Hitting exception");
return Mono.error(new RuntimeException("runtime
error"));
}
});
return response;
}
```
or
```
@GET
@Path("/errors2")
@Produces(APPLICATION_JSON)
public Mono<String> errors2(@PathParam("client") final String client)
{
return Mono.just("String")
.map(r->
{
System.out.println("--- Hitting exception");
throw new RuntimeException();
});
}
```
--
Sent from: http://cxf.547215.n5.nabble.com/cxf-user-f547216.html