RxJava 2/3 Bulkhead operators block the subscribing thread when maxWaitDuration > 0

Author: o-shevchenkoCreated Sep 23, 2026Updated Sep 23, 2026

Resilience4j version: master after #2506 (2.4.1-SNAPSHOT)

Java version: 21

Follow-up to #1592 / #2506, which made the Reactor BulkheadOperator acquire its permission with the non-blocking Bulkhead#acquirePermissionAsync().

The RxJava 2 and RxJava 3 BulkheadOperators (SingleBulkhead, MaybeBulkhead, CompletableBulkhead, ObserverBulkhead, FlowableBulkhead) still call Bulkhead#tryAcquirePermission() in subscribeActual. With maxWaitDuration > 0 that parks the subscribing thread — e.g. an RxJava computation thread or a Netty event loop — for up to the wait duration; the same problem #1592 described for Reactor ("Seems like rxjava2 and rxjava3 versions are also blocking").

Proposal — mirror the Reactor change in both modules:

  • acquire with acquirePermissionAsync(): an already granted permission subscribes upstream exactly as today, an already rejected one emits BulkheadFullException as today;
  • a pending permission hands the downstream a deferred Disposable (via RxJava's DisposableHelper) or, for Flowable, a deferred Subscription (SubscriptionArbiter, the primitive delaySubscription uses) which accumulates requests, subscribes upstream once the permission is granted, cancels the pending request on dispose, and releases a permission granted concurrently with a dispose;
  • release keeps happening in the existing Bulkhead*Observer / BulkheadSubscriber hooks; the public BulkheadOperator API is unchanged, so existing maxWaitDuration > 0 configurations are fixed transparently.

I am preparing a PR with the same test coverage as the Reactor change (queueing, FIFO, timeout, cancellation while waiting, cancellation after a queued grant, error release, Flowable backpressure) and will reference this issue.

Source: resilience4j/resilience4j