yyqdbngt opened a new pull request, #2948:
URL: https://github.com/apache/rocketmq-dashboard/pull/2948
## Summary
- Bounds the `rootMessage` cause-chain walk in `RegistryProbeRunner` (which
had **no** cycle
guard), `MqAdminExtFactory` and `MqClientPool` (whose `cause.getCause() !=
cause` guard only
catches a *direct* self-cycle) with an `IdentityHashMap`-backed visited
set.
- A two-exception cycle (A caused by B, B caused by A) previously looped
forever, pinning the
request/worker thread on every admin call or registry probe whose
underlying exception chain
is cyclic.
- Extracts `protected newPullConsumer`/`newProducer` seams in `MqClientPool`
(mirroring the
existing `MqAdminExtFactory.newAdmin` seam) so the pool can be unit-tested
with stub clients.
## Why
`rootMessage` walks `Throwable.getCause()` to build user-facing 502
messages. Nothing in the
RocketMQ client or remoting stack guarantees cause chains are acyclic
(custom wrappers,
`initCause`, serialization frameworks can create cycles), so an unbounded
walk is a latent
infinite loop on the hot path of every live admin call and every concurrent
registry probe.
`RegistryProbeRunner.rootMessage` runs inside the probe executor; a hang
there also stalls the
`listRegistryClusters` request thread that joins on the probe result.
## Testing
- `mvn
-Dtest=ClusterServiceRegistryTest,MqAdminExtFactoryTest,MqClientPoolTest test`:
Tests run: 21, Failures: 0, Errors: 0, Skipped: 0 (6 + 14 + 1).
- New tests verified to fail on the unfixed code:
`probeAllShouldSurviveCyclicCauseChainWithoutHangingTest` and
`executeShouldSurviveCyclicCauseChainWithoutHanging` each hang until the
10s
`assertTimeoutPreemptively` deadline (Tests run: 20, Failures: 2, Errors:
0).
- The `MqClientPoolTest` case requires the new `newProducer` seam, so its
unfixed counterpart
is the identical unguarded `rootMessage` in `MqClientPool`.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]