question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Resteasy mutiny : multi subscription not cancelled if the request is cancelled from browser.

See original GitHub issue

Describe the bug When using resteasy with mutiny, I am sending an infinite stream as output and have opened the endpoint in the browser http://localhost:8080/block/test After some time I have cancelled the request from browser but the server is still generating data. I am very new to Quarkus and testing out stuff, please correct if I am doing anything wrong. Please check the screenshot for the dependencies used.

@Path("/")
public class ReactiveGreetingResource 
{

    @Inject
    ReactiveGreetingService service;

    private static final Logger LOG = Logger.getLogger(ReactiveGreetingResource.class);

    @GET
    @Produces(MediaType.TEXT_PLAIN)
    @Path("block/{name}")
    public Multi<Long> greeting(@PathParam String name) {
        return Multi.createFrom().ticks().every(
  			  
  			  Duration.ofSeconds(2)).invoke(x -> {
  				  
  				  LOG.info(Thread.currentThread().getName() + "-" + new Date().getSeconds());});
    }

}

Expected behavior Multi should stop generating data if the request is cancelled. The subscription should be cancelled on request cancel.

Actual behavior Multi is still generating data even though the request is cancelled.

Screenshots Screenshot from 2020-12-20 00-27-32

Environment (please complete the following information):

  • Output of uname -a or ver:
  • Output of java -version: 11
  • GraalVM version (if different from Java): 20.3.0.r11-grl
  • Quarkus version or git rev: 1.10.3.Final
  • Build tool (ie. output of mvnw --version or gradlew --version):
Apache Maven 3.6.0
Maven home: /usr/share/maven
Java version: 11.0.9, vendor: GraalVM Community, runtime: .sdkman/candidates/java/20.3.0.r11-grl
Default locale: en_IN, platform encoding: UTF-8
OS name: "linux", version: "5.3.0-46-generic", arch: "amd64", family: "unix"

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
SamarKandalacommented, May 29, 2021

Hold on, was this for RESTEasy or RESTEasy Reactive? I only fixed it for the latter.

@FroMage I am using below dependencies… i have checked with 1.13.6.Final, the issue still exists…

<dependency>
  <groupId>io.rest-assured</groupId>
  <artifactId>rest-assured</artifactId>
  <scope>test</scope>
</dependency>
 <dependency>
  <groupId>org.jboss.logmanager</groupId>
  <artifactId>log4j2-jboss-logmanager</artifactId> 
</dependency>
<dependency>
  <groupId>io.quarkus</groupId>
  <artifactId>quarkus-resteasy-mutiny</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-vertx-web</artifactId>
</dependency>
0reactions
scharalaboscommented, Jun 4, 2021

issue still exists in RESTEasy but in RESTEasy Reactive is fixed, if you can fix it also for RESTEasy it will be perfect!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to handle failures with Mutiny - Quarkus
If it fails, we recover. But the cancellation only cancels that item, not the full stream, meaning we will receive the next one...
Read more >
MultiSubscribe (SmallRye Mutiny 0.12.3 API) - javadoc.io
This method returns a Cancellable to cancel the subscription. This is a "factory method" and can be called multiple times, each time starting...
Read more >
quarkus - What is the point of returning a Multi instead of a Uni ...
At the moment, running a query on the database doesn't return a stream and therefore returning a Multi is usually not helpful.
Read more >
Home of Quarkus Cheat-Sheet - GitHub Pages
Quarkus is a Kubernetes Native Java stack tailored for GraalVM & OpenJDK HotSpot, crafted from the best of breed Java libraries and standards....
Read more >
How to deal with dropped exceptions? - SmallRye Mutiny
The returned Uni is failed with a IOException , but since the subscription itself has been cancelled then there is no way to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found