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

Calling response.bufferEntity() in ResponseExceptionMapper throws BlockingNotAllowedException #31265

Closed
kekbur opened this issue Feb 17, 2023 · 2 comments
Labels
area/rest kind/bug Something isn't working

Comments

@kekbur
Copy link

kekbur commented Feb 17, 2023

Describe the bug

When a RESTEasy Reactive client API interface has a method that returns an InputStream, calling response.bufferEntity() in a ResponseExceptionMapper throws a BlockingNotAllowedException. If the API client method has a different return type, such as String, calling response.bufferEntity() succeeds.

If this is intended behavior the documentation at https://quarkus.io/guides/rest-client-reactive should be updated with instructions on how to deal with this situation.

Strangely, annotating the API client method with @Blocking made no difference.

Moreover, the behavior is dependent on the response body being empty or not. Here is the list of combinations I've tested:

RESTEasy client variant Method return type Response body is empty bufferEntity() throws
reactive InputStream no 🟥yes
reactive InputStream yes 🟩no
reactive String no 🟩no
reactive String yes 🟩no
classic InputStream no 🟩no
classic InputStream yes 🟩no
classic String no 🟩no
classic String yes 🟩no

Expected behavior

Calling response.bufferEntity() should be possible in all cases, or the documentation should be updated to point out the special cases.

Actual behavior

See above.

How to Reproduce?

Reproducer: code-with-quarkus.zip

  1. Run mvn test. Observe RestApiTest#testGetStream failing and RestApiTest#testGetText succeeding.

Output of uname -a or ver

CYGWIN_NT-10.0-22000

Output of java -version

java version "17.0.3.1" 2022-04-22 LTS Java(TM) SE Runtime Environment (build 17.0.3.1+2-LTS-6) Java HotSpot(TM) 64-Bit Server VM (build 17.0.3.1+2-LTS-6, mixed mode, sharing)

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.16.2.Final

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

Apache Maven 3.8.6

Additional information

No response

@kekbur kekbur added the kind/bug Something isn't working label Feb 17, 2023
@quarkus-bot
Copy link

quarkus-bot bot commented Feb 18, 2023

/cc @FroMage (resteasy-reactive), @Sgitario (resteasy-reactive), @geoand (resteasy-reactive), @stuartwdouglas (resteasy-reactive)

@Sgitario
Copy link
Contributor

Thanks for reporting! This is duplicated by #30312.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/rest kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants