Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BlockingNotAllowedException when using rest client since quarkus 3.18.1 #45985

Closed
Malandril opened this issue Jan 30, 2025 · 4 comments · Fixed by #46006
Closed

BlockingNotAllowedException when using rest client since quarkus 3.18.1 #45985

Malandril opened this issue Jan 30, 2025 · 4 comments · Fixed by #46006
Milestone

Comments

@Malandril
Copy link
Contributor

Describe the bug

When using a rest-client returning an InputStream

@RegisterRestClient(configKey="waow")
public interface MyRemoteService {

    @GET
    @Path("/hello")
    InputStream getExtensionsById();
}

Calling the client fails with

    Suppressed: org.jboss.resteasy.reactive.common.core.BlockingNotAllowedException: Attempting a blocking read on io thread
                at org.jboss.resteasy.reactive.client.handlers.VertxClientInputStream$VertxBlockingInput.readBlocking(VertxClientInputStream.java:187)
                at org.jboss.resteasy.reactive.client.handlers.VertxClientInputStream.readIntoBuffer(VertxClientInputStream.java:69)
                at org.jboss.resteasy.reactive.client.handlers.VertxClientInputStream.close(VertxClientInputStream.java:97)
                at org.jboss.resteasy.reactive.client.handlers.ClientResponseCompleteRestHandler.mapToResponse(ClientResponseCompleteRestHandler.java:124)
                at org.jboss.resteasy.reactive.client.handlers.ClientResponseCompleteRestHandler.handle(ClientResponseCompleteRestHandler.java:35)
                at org.jboss.resteasy.reactive.client.handlers.ClientResponseCompleteRestHandler.handle(ClientResponseCompleteRestHandler.java:31)
                at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.invokeHandler(AbstractResteasyReactiveContext.java:231)
                at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.run(AbstractResteasyReactiveContext.java:147)
                at io.smallrye.context.impl.wrappers.SlowContextualRunnable.run(SlowContextualRunnable.java:19)
                at org.jboss.resteasy.reactive.client.handlers.ClientSwitchToRequestContextRestHandler$1$1.handle(ClientSwitchToRequestContextRestHandler.java:38)
                at org.jboss.resteasy.reactive.client.handlers.ClientSwitchToRequestContextRestHandler$1$1.handle(ClientSwitchToRequestContextRestHandler.java:35)
                at io.vertx.core.impl.ContextInternal.dispatch(ContextInternal.java:270)
                at io.vertx.core.impl.ContextInternal.dispatch(ContextInternal.java:252)
                at io.vertx.core.impl.ContextInternal.lambda$runOnContext$0(ContextInternal.java:50)
                at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:173)
                at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:166)
                at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
                at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:566)
                at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
                at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
                at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
                at java.base/java.lang.Thread.run(Thread.java:1583)

If you switch to a String, it works as expected

Expected behavior

Returning a InputStream should work as expected in already blocking context.

Actual behavior

Returning a InputStream in a blocking context fails with BlockingNotAllowedException

How to Reproduce?

Clone https://github.com/Malandril/quarkus-rest-test and run the tests

Output of uname -a or ver

No response

Output of java -version

No response

Quarkus version or git rev

3.18.1

Build tool (ie. output of mvnw --version or gradlew --version)

No response

Additional information

Does not happen in quarkus 3.17.3

@Malandril Malandril added the kind/bug Something isn't working label Jan 30, 2025
Copy link

quarkus-bot bot commented Jan 30, 2025

/cc @cescoffier (rest-client), @geoand (rest-client)

@geoand
Copy link
Contributor

geoand commented Jan 30, 2025

Thanks for reporting.

I'll have a look tomorrow

@Malandril
Copy link
Contributor Author

@geoand
Copy link
Contributor

geoand commented Jan 31, 2025

Right.

The easy fix to revert 7841f90 but I want to have a deeper look at what's going on

geoand added a commit to geoand/quarkus that referenced this issue Jan 31, 2025
gastaldi added a commit that referenced this issue Jan 31, 2025
Don't prematurely close an InputStream returned by the REST Client
@quarkus-bot quarkus-bot bot added this to the 3.19 - main milestone Jan 31, 2025
@gsmet gsmet modified the milestones: 3.19 - main, 3.18.2 Feb 4, 2025
gsmet pushed a commit to gsmet/quarkus that referenced this issue Feb 4, 2025
carlesarnal pushed a commit to carlesarnal/quarkus that referenced this issue Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants