-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Reactor Bulkhead operator blocks if max wait duration is set #1592
Comments
Hi, PRs are welcome |
Hi, thanks for your PR. What we need is a The non-blocking Bulkhead could be based on a semaphore and a non-blocking, thread-safe, circular fifo queue. Instead of using a time to live per permission request, we could use a circular array which queues N permission requests. We do have a good implementation of a circular fifo queue. On every
A permission request is queued, until
When a permission is released, we pick the first permission request from the queue and allow the permission with Since we have a circular queue, new permission requests will drop older permission requests automatically. We don't need any scheduler to remove tasks from the queue. |
Resilience4j version: 1.7.0
Java version: 17
MonoBulkhead and FluxBulkhead operators both use
bulkhead.tryAcquirePermission()
during the subscription. This is not ideal sincebulkhead.tryAcquirePermission()
callssemaphore.tryAcquire(timeout, TimeUnit.MILLISECONDS)
which blocks a thread on which subscription is being executed, as per javadoc of tryAcquire:
so ,for example, it might block IO thread which is used to serve other requests.
Both of those operators should never block and instead:
Seems like rxjava2 and rxjava3 versions are also blocking.
The text was updated successfully, but these errors were encountered: