-
Notifications
You must be signed in to change notification settings - Fork 3k
Description
Describe the bug
My case:
- I subscribe on several
Unis
which are usingRestClient
async calls, but all available connections forRestClient
are busy - Then I cancel subscriptions of this
Unis
- When connections for
RestClient
become available, RestClient calls executed fromUni
that I just cancelled.
This is unexpected and not obvious behavior
I've found an Issue #41971 that was fixed, but as I see it only cancels requests that are already executing. In my case some requests (even after Uni cancelling) end up in some queue (?), and then are executed.
Prepared simple project for issue reproducing
https://github.com/g0rba4ev/quarkus_requests_not_cancelled
Check and run FooTest.java
There is a log in attachments (some lines with Responses are omitted for clarity)
log_resp_delay_10.log
I discovered that only some requests of cancelled Unis are executed, and this number of requests vary depending on delay of MockServer response.
You can change the variable delaySec
at line 26 of file WiremockPlus.java
and run the test to make sure of this dependency. (e.g. try 5 sec or 20 sec).
Maybe some queue of connection waiters is cleaned by some event or whatever, but I didn't manage to get any correlation between time interval from moment of cancelling Uni to moment of releasing occupied connections
and number of executed requests from Uni that were cancelled
.
The only correlation I've found is described above (delay of serves response)
I guess these "not cancelled" requests are stuck somewhere in SipmleConnectionPool
, but I didn't dig deeper and I'm not sure.
Check io.vertx.core.net.impl.pool.SimpleConnectionPool.Acquire#execute
method, lines under comment
// 4. Fall in waiters list
Feel free to ask any question.
Sincerely yours, g00d_men.
Expected behavior
All requests from cancelled Unis (requests that were in some queue) are not going to be sent
Actual behavior
Some of requests from cancelled Unis ( (requests that were in some queue) are sent
How to Reproduce?
- Download project https://github.com/g0rba4ev/quarkus_requests_not_cancelled
- Run
FooTest.java
Or:
- Limit the number of connections for RestClient
- Occupy all these connections
- Create some Unis triggering RestClient async calls (more than a number of allowed parallel connections) and subscribe on them
- Cancel subscriptions on Unis
- Observe (e.g. by logs) that requests are still sent despite the fact that Unis were cancelled.
Output of uname -a
or ver
No response
Output of java -version
No response
Quarkus version or git rev
No response
Build tool (ie. output of mvnw --version
or gradlew --version
)
No response
Additional information
No response