[BUG] IllegalStateException when cancelling Service Bus session acquisition on a Reactor thread

オープン
#51,213 コメント 2 件 リアクション 1 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
56/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
azure, java
領域
backend

調査の方向性

Start with ServiceBusSessionAcquirer.java around the cancellation cleanup at line 213, then trace how it disposes the receive link through ReactorReceiver.java and its close methods. Compare the 7.17.17 and 7.18.1 cancellation paths and inspect related tests for session acquisition cancellation. Done means cancellation closes the link without triggering Reactor’s blocking-operation exception and the processor handles the acquisition outcome.

索引モデルが issue の本文から書いたものです。

説明

Client customer-reported needs-team-attention question Service Attention Service Bus

Describe the bug

A session-enabled Service Bus processor intermittently raises a Reactor IllegalStateException when session acquisition is cancelled.

The exception occurs while the SDK closes the receive link after cancellation. The close operation calls Mono.block(...) from a Reactor non-blocking scheduler thread.

Exception or Stack Trace

java.lang.IllegalStateException: block()/blockFirst()/blockLast() are blocking, which is not supported in thread parallel-2
    at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:121)
    at reactor.core.publisher.Mono.block(Mono.java:1754)
    at com.azure.core.amqp.implementation.ReactorReceiver.close(ReactorReceiver.java:309)
    at com.azure.core.amqp.implementation.ReactorReceiver.dispose(ReactorReceiver.java:304)
    at com.azure.messaging.servicebus.ServiceBusSessionAcquirer.lambda$acquireSession$4(ServiceBusSessionAcquirer.java:213)
    at reactor.core.publisher.FluxDoFinally$DoFinallySubscriber.runFinally(FluxDoFinally.java:146)
    at reactor.core.publisher.FluxDoFinally$DoFinallySubscriber.cancel(FluxDoFinally.java:135)
    at reactor.core.publisher.MonoFlatMap$FlatMapMain.cancel(MonoFlatMap.java:207)
    at reactor.core.publisher.Operators$MultiSubscriptionSubscriber.drainLoop(Operators.java:2425)
    at reactor.core.publisher.FluxTimeout$TimeoutMainSubscriber.handleTimeout(FluxTimeout.java:295)

To Reproduce

  1. Use a session-enabled Service Bus queue or subscription.
  2. Create a session-enabled ServiceBusProcessorClient.
  3. Start the processor.
  4. Let session acquisition be cancelled, for example when acquisition times out while a receiver is being created.
  5. Observe the exception during receiver disposal.
    The issue is intermittent and depends on session acquisition cancellation, broker latency, or session contention.
    Expected behavior
    Cancelling session acquisition should close the receive link without invoking a blocking operation on a Reactor non-blocking thread.
    The processor should recover or report the acquisition failure without raising a Reactor blocking-operation exception.

Screenshots

Not applicable.

Setup

  • OS: Linux, running in Kubernetes
  • Libraries:
  • com.azure:azure-messaging-servicebus:7.18.1
  • com.azure:azure-core-amqp:2.12.2
  • Previous version: com.azure:azure-messaging-servicebus:7.17.17
  • Java version: 21
  • App Server/Environment: Kubernetes
  • Frameworks:
  • Spring Boot
  • Reactor
  • OpenTelemetry Java agent

Additional context

The issue appeared after upgrading the Azure SDK from: azure-messaging-servicebus:7.17.17 (azure-core-amqp:2.12.1) to: azure-messaging-servicebus:7.18.1 (azure-core-amqp:2.12.2)
The new version was deployed on 6 November 2026. The exception then appeared intermittently in Application Insights.
By comparing the implementations between 7.17.17 and 7.18.1, the session acquisition cancellation path appears to have changed.
In 7.18.1, cancellation disposes the receive link. ReactorReceiver.dispose() delegates to close(), which synchronously calls closeAsync().block(...).
The corresponding cancellation cleanup callback is not present in 7.17.17.
No application code calls block() in this execution path. The blocking call originates inside the Azure SDK during cancellation cleanup.
The issue was observed with session-enabled consumers.

Information Checklist

  • Bug Description Added
  • Repro Steps Added
  • Setup information Added
主要言語
Java
スター
2.6k
フォーク
2.2k
平均マージ
1日 17時間
マージ済み PR(30日)
259

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Azure/azure-sdk-for-java のほかの issue

Azure/azure-sdk-for-java の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。