You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "merlimat (via GitHub)" <gi...@apache.org> on 2026/06/18 21:35:59 UTC
[PR] [fix][broker] Avoid blocking the metrics thread on the pending-ack managed ledger [pulsar]
merlimat opened a new pull request, #26062:
URL: https://github.com/apache/pulsar/pull/26062
### Motivation
`TransactionAggregator.generate` (per-subscription transaction metrics) read the pending-ack store's managed ledger with `((PersistentSubscription) subscription).getPendingAckManageLedger().get()` — an **un-timed** `CompletableFuture.get()` running on the prometheus-stats executor (a bounded, 4-thread pool).
The guard `checkIfPendingAckStoreInit()` only verifies `pendingAckStoreFuture.isDone()`; `getStoreManageLedger()` then composes `pendingAckStoreFuture.thenCompose(store -> store.getManagedLedger())`, so the *managed-ledger* future can still be resolving. A stuck future blocks that metrics thread, and enough of them exhaust the pool — hanging all metric scraping.
### Modifications
Use `getNow(null)` instead of `get()`: if the managed ledger is already resolved it is used exactly as before; if not, this subscription's pending-ack-store stats are skipped for the current scrape and picked up on the next one. A future that completed exceptionally still throws into the existing `catch` (unchanged).
### Verifying this change
Covered by existing tests, which pass: `TransactionMetricsTest.testManagedLedgerMetrics` (ledger ready → stats present) and `testManagedLedgerMetricsWhenPendingAckNotInit` (store not initialized → skipped).
### Does this pull request potentially affect one of the following parts:
*If the box was checked, please highlight the changes*
- [ ] Dependencies (add or upgrade a dependency)
- [ ] The public API
- [ ] The schema
- [ ] The default values of configurations
- [ ] The threading model
- [ ] The binary protocol
- [ ] The REST endpoints
- [ ] The admin CLI options
- [ ] The metrics
- [ ] Anything that affects deployment
--
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@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [fix][broker] Avoid blocking the metrics thread on the pending-ack managed ledger [pulsar]
Posted by "lhotari (via GitHub)" <gi...@apache.org>.
lhotari merged PR #26062:
URL: https://github.com/apache/pulsar/pull/26062
--
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@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org