You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "KimJohn Quinn (JIRA)" <ji...@apache.org> on 2019/04/15 22:00:00 UTC
[jira] [Created] (CXF-8022) Thread hangs using Reactor Flux when
Exeption is Thrown
KimJohn Quinn created CXF-8022:
----------------------------------
Summary: Thread hangs using Reactor Flux when Exeption is Thrown
Key: CXF-8022
URL: https://issues.apache.org/jira/browse/CXF-8022
Project: CXF
Issue Type: Bug
Components: JAX-RS
Affects Versions: 3.3.1
Environment: * JDK 11
* CXF 3.3.1
* Spring Boot (latest)
* Undertow (latest)
* Reactor (latest)
Reporter: KimJohn Quinn
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?
We wanted to stick with using CXF for both our standard REST resources and Reactor resources because CXF has always worked well for us plus we are using the OpenAPI swagger integration. Not being able to resolve this or have an established workaround may cause us to have to completely revert to Spring controllers.
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.
{code:java}
@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;
} {code}
I also posted this on the forums hoping someone can assist - [http://cxf.547215.n5.nabble.com/Thread-hangs-when-using-reactor-cxf-and-undertow-td5796369.html]
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)