-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
IllegalStateException: The current thread cannot be blocked
using quarkus-cache
with quarkus-resteasy-reactive
#22251
Comments
/cc @FroMage, @geoand, @gwenneg, @stuartwdouglas |
Fixes quarkusio#22251 (cherry picked from commit 17e42fa)
I'm having this same problem using Multi instead Uni. |
Hi @Leonardofreua. Caching |
Was this fixed (in which version) ? I still have (probably) same issue (quarkus 2.6.1) 2022-01-24 14:44:00,064 ERROR [io.sma.rea.mes.provider] (vert.x-eventloop-thread-14) SRMSG00201: Error caught while processing a message: java.lang.IllegalStateException: The current thread cannot be blocked: vert.x-eventloop-thread-14 I consuming kafka messages using Incomming annotation. Consumer needs some configuration, which is retrieved from etcd (Uni converted from CompletableFuture). That Uni result is cached (using CachedResult) and everything works ok. But when cache is invalidated calling empty method with CacheInvalidation annotation, then it just dies. |
@mmizera Could you please show me the signature of the method annotated with |
#22683 may fix your issue but it will only be available with Quarkus |
Ok, It was probably "false-positive". I reviewed my code again and problem was in cache method signature. I used generic response type T, so it was blocking. I modified it to and it works. There is if in CacheResultInterceptor for this, so with generic result it ends in blocking block of source code. |
If I want to cache the outcome of a Multi as an Uni, it causes a blocking Thread when this method is used by an REST Endpoint as well. In my opinion that should work: @CacheResult(cacheName = "uniListCache") Can you verify that? I attached a test: |
Hi @manuelwallrapp. The thread is blocked because of the cached method body and not because of the If you remove the
|
Hi @gwenneg Oh my bad. The asStream call creates a blocking call. Thank you very much. Would be great to put such an example in the Cache guide. |
Describe the bug
Using
quarkus-cache
together with reactive execution model causes anIllegalStateException
.Calling e.g. a reactive endpoint:
results in:
Expected behavior
OK response.
Actual behavior
How to Reproduce?
reactive-cache-reproducer.zip
Use attached reproducer:
Output of
uname -a
orver
Linux 5.15.6-200.fc35.x86_64
Output of
java -version
openjdk version "11.0.11" 2021-04-20 OpenJDK Runtime Environment AdoptOpenJDK-11.0.11+9 (build 11.0.11+9) OpenJDK 64-Bit Server VM AdoptOpenJDK-11.0.11+9 (build 11.0.11+9, mixed mode)
GraalVM version (if different from Java)
No response
Quarkus version or git rev
999-SNAPSHOT (2.6 - main)
Build tool (ie. output of
mvnw --version
orgradlew --version
)Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)
Additional information
No response
The text was updated successfully, but these errors were encountered: