-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
QoSHandler does not resume on a virtual thread #12171
Comments
Now QoSHandler attempts to resume using a virtual thread if the request was handled with a virtual thread and then suspended. Removed warn() from VirtualThreads.isVirtualThread(), it was too verbose. Signed-off-by: Simone Bordet <[email protected]>
Firstly, I don't think this should be an issue. An application should not care if it is given a real thread or a virtual thread. In our normal virtual thread mode, there will always be some normal threads used for callbacks and these can be further dispatched into the application. If a user really cares about this, then they should use the all-virtual mode and then hopefully the "ThreadPool" returned by Perhaps in normal virtual thread mode we want a simple method that will do the same logic as our strategy (virtual thread for blocking invocations, just call otherwise)? |
@gregw no, we are quite precise with the above, and we have tests that prove that all callbacks to applications are actually performed in virtual threads, even when using the "mixed" mode thread pool, see e.g. https://github.com/jetty/jetty.project/blob/jetty-12.0.12/jetty-ee10/jetty-ee10-tests/jetty-ee10-test-client-transports/src/test/java/org/eclipse/jetty/ee10/test/client/transport/VirtualThreadsTest.java#L85. In this view, this issue and related PR make sense, as applications may want to use virtual threads to be invoked, but they also do not want to pin carriers in NIO's As for the method to capture the logic, I can add a method
if (_virtualExecutor != null)
virtualExecutor.execute(task);
else
_executor.execute(task); |
@sbordet I think that test is only passing because the callbacks are blocking. If a core handler sets a demand callback that was non blocking, then it mm ay be called with a native thread. It just so happens that all callbacks in servlets are seen as blocking. I don't think apps should be making them decision. They should just can execute on the thread pool and let them configuration make them decision. |
It does not happen, we made it on purpose, because it is application code that we don't know what it does.
Not sure I follow. The configuration is "call apps with a virtual thread", so if we don't it's a bug. |
Now QoSHandler attempts to resume using a virtual thread if the request was handled with a virtual thread and then suspended. Removed warn() from VirtualThreads.isVirtualThread(), it was too verbose. Signed-off-by: Simone Bordet <[email protected]>
Jetty version(s)
12
Description
See #12154 (comment).
When
QoSHandler
resumes a request that was dispatched on a virtual thread, it is resumed on a non-virtual thread.The text was updated successfully, but these errors were encountered: