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
Mutiny and Resteasy integration sometimes fails with "Attempted to do blocking IO from the IO thread" #8152
Comments
First, I would simplify the code:
|
If we do blocking IO it means we must have a filter that disabled async IO. But I was pretty sure I would detect and reject it. Is this with |
Can we get the full stack trace? |
Sorry, I forgot to attach it. Here it is. |
@cescoffier |
I have this dependency for WebSockets; it seems that is used for REST, too, although I do not need it.
|
I removed a few subscribeOn and emitOn. And yes, location matters. |
Yeah, i see the gzip interceptor which forces blocking IO. |
Isn't it needed for "persist" (database operation)? "extractFiles" just unzips from byte[] so it is probably not needed there. |
I removed |
Can you show me the new stack trace then? |
I already changed it because of the issues, but I will try to reproduce it again, maybe later today. |
I still see GZIP:
|
You are right, it disappeared just from the cause "java.lang.IllegalStateException" (java.util.zip.GZIPOutputStream). |
I am experiencing the same issue when I define in application.properties following : My question is shouldn't the request be handled by a Worker Thread when using JaxRS ? Or is a Mutiny JaxRS Route being handled on a IO Thread like Reactive Routes ? |
Jax-RS method returning Mutiny types are still called on the worker thread pool. However, depending on what you do in the method, you may get back to an event loop (typically if you use a reactive client). |
@stuartwdouglas can you remind me what you told me about being able to run gzip in an async fashion? |
@cescoffier Ok then, correct me if I am wrong, I have to use an |
You can use java.util.zip.Deflater and java.util.zip.Inflater. |
@akoufa yiu can use ‘Infrastructure.getDefaultExecutor()’ |
@FroMage @stuartwdouglas Can't Quarkus Gzip support via enabling it in application properties be changed to be async instead of blocking ? |
Shouldn't quarkus make sure that gzip is run on the correct thread? I don't think this should be something user's need to know about. |
@stuartwdouglas thanks.
Well yeah, if we can make gzip work with async IO, it will be automatic. |
Maybe I don't get all the stuff that comes together here. But as far as I understood, it would be fixable by changing the thread to the jaxrs worker thread again, am I right? If so, couldn't quarkus switch the thread of the Uni/Multi back to the jaxrs thread before doing any more jaxrs/response handling/gzip stuff with it? |
Hi, Any update on this please? I also got the same issue. Is it possible to enhance quarkus to use gzip for aysnc also? |
No update so far, I haven't had time to look at it. If you want to contribute I could help you? |
We running into the same problem, has someone found a workaround yet? Were trying to stream about 9.000.000 json objects and gzip would be nice :D |
Have you tried |
We added gzip on the nginx layer |
Closing - out of date. |
Describe the bug
Often Multi returned to Resteasy causes exception, although both database and Kafka are executed in a worker thread.
Code:
sendMessage returns CompletableFuture:
Exception:
It seems that error does not happen when emmiter.send is used without the future.
Expected behavior
Resteasy should just execute the request as all blocking operations are moved to worker threads.
Actual behavior
Resteasy complaints about blocking operation.
To Reproduce
Steps to reproduce the behavior:
Configuration
# Add your application.properties here, if applicable.
Screenshots
(If applicable, add screenshots to help explain your problem.)
Environment (please complete the following information):
uname -a
orver
: Microsoft Windows [Version 10.0.19041.153]java -version
: 1.8mvnw --version
orgradlew --version
): Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)Additional context
@cescoffier https://groups.google.com/forum/#!topic/smallrye/J4fEeQYfM5w
The text was updated successfully, but these errors were encountered: