-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
RESTEasy Reactive Kotlin is using a Worker-Thread and not a Vert.x-Event-Thread #16739
Comments
Hi @evanchooly |
That is definitely a bug. Not blocking the worker threads has almost no interest. What you don't want to block is the I/O thread. Co-routine should be dispatched on the Vert.x context handling the request. |
Hi all, I've made some changes to capture the vertex context and run the coroutines on a vertex worker. It seems to run in the correct thread, but I'm very new to quarkus internals and I may missing something. The changes are here, check it out https://github.com/pak3nuh/quarkus/tree/delegates-coroutine-to-vertex-worker |
Those changes look alright, but that module is currently being moved in #16838 so perhaps let's wait until that is merged before you open a PR here? |
Sure @FroMage, can you ping me when I have the green light? |
Sure, added a note there. Thanks. |
@pak3nuh I just merged that other PR if you want to rebase. |
Hi all. |
Describe the bug
Since Quarkus 2.0.0Alpha1 it is possible to implement suspend functions for REST endpoints. However, the executing thread is a worker thread (DefaultDispatcher-worker) and not, as expected, a Vert.x event thread (vert.x-eventloop-thread).
Expected behavior
The supend function is executed in a Vert.x event thread (vert.x-eventloop-thread).
Actual behavior
The supend function is executed in a worker thread (DefaultDispatcher-worker) from the GlobalDispatcher.
To Reproduce
Environment (please complete the following information):
Output of
uname -a
orver
Microsoft Windows [Version 10.0.19041.928]
Output of
java -version
openjdk version "11.0.10" 2021-01-19
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.10+9)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.10+9, mixed mode)
Quarkus version or git rev
2.0.0.Alpha1
Build tool (ie. output of
mvnw --version
orgradlew --version
)Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Java version: 11.0.10, vendor: AdoptOpenJDK
Default locale: de_DE, platform encoding: UTF-8
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
Additional context
The problem is that GlobalScope is used without explicitly specifying a dispatcher. The default dispatcher, which works with its own worker pool, is then used by default (https://github.com/evanchooly/quarkus/blob/35c4fcab17f36606e2e4fbbdca6bac4f24aea45d/extensions/resteasy-reactive/quarkus-resteasy-reactive/runtime/src/main/kotlin/org/jboss/resteasy/reactive/server/runtime/kotlin/CoroutineInvocationHandler.kt#L16-L27).
Possible Solution (?): #10162 (comment)
The text was updated successfully, but these errors were encountered: