[Bug] DefaultReceiptHandleManager leaves its renew and return-handle thread pools running after shutdown

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

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

@iloveeyjafjalla がすでに取り組んでいます。

2026年10月13日 から。

  • #11394 @iloveeyjafjalla による — オープン
  • #11421 @Asthenia0412 による — オープン

評価

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

調査の方向性

Start in DefaultReceiptHandleManager: read its constructor, where renewalWorkerService and returnHandleGroupWorkerService are created, and its shutdown() method, which currently only stops scheduledExecutorService and calls clearAllHandle(). Confirm that nothing shuts the two pools down. Done means both pools are shut down after clearAllHandle() returns, so remaining handles still reach a running pool. Two open pull requests (#11394, #11421) already target this, so check them before starting.

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

説明

Before Creating the Bug Report
  • I found a bug, not just asking a question, which should be created in GitHub Discussions.
  • I have searched the GitHub Issues and GitHub Discussions of this repository and believe that this is not a duplicate.
  • I have confirmed that this bug belongs to the current repository, not other repositories of RocketMQ.
Runtime platform environment

OS: any (proxy module, receipt handle renewal)

RocketMQ version

branch: develop
Git commit id: a7edeecfb (2026-10-13; the file is unchanged by that commit)

JDK Version

Compiler: Temurin 1.8.0_504 (target 1.8, same as CI)

Describe the Bug

DefaultReceiptHandleManager never shuts down the two worker pools it creates.

The constructor creates both pools for itself:

this.renewalWorkerService = ThreadPoolMonitor.createAndMonitor(
    proxyConfig.getRenewThreadPoolNums(), proxyConfig.getRenewMaxThreadPoolNums(), 1, TimeUnit.MINUTES,
    "RenewalWorkerThread", proxyConfig.getRenewThreadPoolQueueCapacity());
this.returnHandleGroupWorkerService = ThreadPoolMonitor.createAndMonitor(
    proxyConfig.getReturnHandleGroupThreadPoolNums(), proxyConfig.getReturnHandleGroupThreadPoolNums() * 2,
    1, TimeUnit.MINUTES, "ReturnHandleGroupWorkerThread", proxyConfig.getRenewThreadPoolQueueCapacity());

but the shutdown registered with the manager's lifecycle only stops the scheduler and clears the handles:

public void shutdown() throws Exception {
    scheduledExecutorService.shutdown();
    clearAllHandle();
}

renewalWorkerService.shutdown() / returnHandleGroupWorkerService.shutdown() appear nowhere in the repository (only
creation and use), and the threads are not daemons (ThreadFactoryBuilder().setNameFormat(...), no setDaemon(true)), so
after the manager is shut down — e.g. an in-JVM proxy stop/restart (embedded use, integration tests, or a restart within one
process) — up to renewThreadPoolNums + returnHandleGroupThreadPoolNums (defaults 2 + 2, max doubled) threads plus their
queued renew/return tasks keep running against services that are being torn down.

Steps to Reproduce
  1. Run the proxy so at least one handle renewal is scheduled (enableProxyAutoRenew=true is the default).
  2. Stop the proxy in the same JVM (the manager's shutdown() runs through the proxy lifecycle).
  3. renewalWorkerService.isShutdown() and returnHandleGroupWorkerService.isShutdown() are both false; the
    RenewalWorkerThread-* / ReturnHandleGroupWorkerThread-* threads are still alive.
Expected behavior

shutdown() releases the pools it created, after the remaining handles have been handed back
(clearAllHandle() submits them to returnHandleGroupWorkerService).

Actual behavior

The two pools keep running past the shutdown.

Additional context

Fix: shut both pools down at the end of the manager's shutdown, after clearAllHandle() so the remaining handles are still
submitted to a running pool.

主要言語
Java
スター
22.7k
フォーク
12k
平均マージ
3日 18時間
マージ済み PR(30日)
17

環境構築

はじめの一歩

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

apache/rocketmq のほかの issue

apache/rocketmq の issue をすべて見る

似ている issue

Java の issue をもっと見る

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

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