-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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 blocking code from SecurityIdentityAugmentor causes concurrent requests to be limited by the number of event loop threads #43217
Comments
/cc @sberyozkin (security) |
Thanks @lorenzobenvenuti, I wonder though, is it a bug or the way the pools are managed right now in general and it really should be re-qualified into an enhancement request. May be it can be just configured, to control the number the pool threads etc ? |
The @sberyozkin yeah, let's wait till Clemetn, Julien Pong or Viet finds a time and have a quick look on how we do blocking. Thanks |
makes sure your executeBlocking set ordered=false. |
Yes, alright, our |
https://vertx.io/docs/vertx-core/java/#blocking_code says By default, if executeBlocking is called several times from the same context then the different executeBlocking are executed serially.. But:
What doesn't add up is that:
Do I understand it right @cescoffier that Any hint would be appreciated when the time is right for you. |
No ordered is not about duplicated but root context (event loops). |
Thanks. In that case, we don't want order. I'll re-check reproducer later. |
Thank you very much @lorenzobenvenuti for reporting this issue with very nice description. I didn't use your reproducer but it's always great to have it. |
Thanks all for the quick fix! Will the fix be backported to 3.8 or do we need to wait until 3.15 (we want to stick to LTS versions). Thanks, lorenzo |
Added backport label for 3.8, it's proposal. Backports to 3.8 needs to be conservative, so please watch backports linked to this issue/commit that fixed it. |
Describe the bug
Hi,
we have an application calling some blocking code from a
SecurityIdentityAugmentor
(usingauthenticationRequestContext.runBlocking
); under some circumstances, this code may take longer than expected and when this happens we've noticed that requests seemed to be queued. After some investigation we found out that the application can't handle more than N requests where N = number of event loop threads... but, since the blocking tasks run in a worker thread, I was expecting the application to handle up to M requests, where M = number of worker threads.For example, say the event loop has 2 threads and the blocking task takes 5s: if three users perform a request at the same time, two requests will take 5s and one will take 10s because it won't be processed until the first two complete. However, if an unauthenticated request (i.e. blocking task is not run) is performed while some blocking tasks are running, it's served immediately which shows that the event loop threads are not busy.
You can find a reproducer here: https://github.com/lorenzobenvenuti/security-augmentor-blocking-issue
Thanks,
lorenzo
Expected behavior
Number of concurrent requests is limited by the number of worker threads
Actual behavior
Number of concurrent requests is limited by the number of event loop threads
How to Reproduce?
https://github.com/lorenzobenvenuti/security-augmentor-blocking-issue
Output of
uname -a
orver
Linux 6.10.6-100.fc39.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Aug 19 14:35:32 UTC 2024 x86_64 GNU/Linux
Output of
java -version
openjdk version "17.0.12" 2024-07-16 OpenJDK Runtime Environment (Red_Hat-17.0.12.0.7-2) (build 17.0.12+7) OpenJDK 64-Bit Server VM (Red_Hat-17.0.12.0.7-2) (build 17.0.12+7, mixed mode, sharing)
Quarkus version or git rev
3.14.2 (also tested with 3.8 which is the one used by our app)
Build tool (ie. output of
mvnw --version
orgradlew --version
)Apache Maven 3.9.1 (Red Hat 3.9.1-3)
Additional information
No response
The text was updated successfully, but these errors were encountered: