You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "yyqdbngt (via GitHub)" <gi...@apache.org> on 2026/07/31 12:43:29 UTC
[PR] fix: prevent idle-close from shutting down in-use consumer, and avoid NPE in per-user pool aspect [rocketmq-dashboard]
yyqdbngt opened a new pull request, #708:
URL: https://github.com/apache/rocketmq-dashboard/pull/708
### Motivation
Two concurrency / robustness bugs found while reviewing the message-query and admin-pool code:
1. **Idle-close task could shut down a consumer while it is still in use**
`AutoCloseConsumerWrapper` returns the shared `DefaultMQPullConsumer` and a background task closes it after 60s of idleness. The check-and-close runs on a separate scheduler thread with no knowledge of threads currently using the consumer, so a long-running query (e.g. scanning many queues in `queryMessageByTopic`) could have the consumer shut down mid-use, making the pull fail with an exception. Also, `getConsumer` handed out the consumer after releasing the lock, so the close could slip in between the null-check and the return.
Fix: track an in-use counter. `getConsumer` now acquires the consumer and increments the counter under the same lock used by `close()`, and adds `releaseConsumer()` which the callers invoke in `finally` blocks. The idle-close task only proceeds when the counter is zero.
2. **`MQAdminAspect` could NPE when per-user isolation is enabled but no user is in context**
When `loginRequired` is on and the auth mode is not `file`, every non-whitelisted `MQAdminExt` method tries to borrow a per-user `MQAdminExt` using `currentUserInfo.getUsername()`. On background/scheduled threads there is no user in `UserInfoContext`, so this throws a `NullPointerException`. The aspect now falls back to the default pool when no user info is present.
### Verification
`mvn compiler:compile` passes (`BUILD SUCCESS`).
### Diff
3 files changed, +50 / -20.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Studio] Protect active consumers and missing user context [rocketmq-dashboard]
Posted by "yyqdbngt (via GitHub)" <gi...@apache.org>.
yyqdbngt closed pull request #708: [Studio] Protect active consumers and missing user context
URL: https://github.com/apache/rocketmq-dashboard/pull/708
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org