#26485·risingwave

meta: compaction task dispatch can stall permanently (dedicated event handler blocks, pull protocol latches silent); compactor restart cannot recover

Author: maybe-vibeCreated Jul 29, 2026Updated Sep 28, 2026
Labelsno-issue-activity

Summary

Meta's hummock compaction task dispatch can permanently stall with no error logs: the dedicated event-handler task that processes all compactor PullTask/ReportTask events can block forever, and the pull protocol then latches the whole system silent. Restarting compactors does not recover (their fresh PullTask lands in the dead handler's channel); only a meta restart does. On a cluster where a compaction group subsequently hits an L0 write-stop, this escalates to a cluster-wide barrier stall: the write limiter parks executors, and the write-stop can never clear because nothing compacts.

Observed in production on v2.8.3. The implicated code is unchanged on current main (verified by diff: compact_task_dedicated_event_handler is byte-identical; report_compact_tasks and move_state_tables_to_dedicated_compaction_group structurally equivalent).

Architecture: why one blocked await latches everything

Three properties in src/meta/src/hummock/manager/compaction/compaction_event_loop.rs compose badly:

  1. Single point of failure, zero observability. PullTask/ReportTask events are forwarded from the compaction event loop through an unbounded channel to a single dedicated task (compact_task_dedicated_event_handler). It is spawned with a bare tokio::spawn — no await-tree registration, no watchdog, no logging. If it blocks on any await inside one event, events pile up in the channel forever and nothing anywhere logs an error.
  2. The protocol latches silent. PullTaskAck is only sent after task selection returns (handle_pull_task_event), and the in-tree compactor node gates its next PullTask on receiving the previous ack (pull_task_ack in src/storage/src/hummock/compactor/mod.rs). One swallowed pull therefore stops such a compactor from ever pulling again — after the handler blocks, even the inbound event stream goes quiet, making the failure indistinguishable from an idle system. Even a client that keeps re-pulling without ack-gating receives nothing: its events just queue into the dead handler's channel.
  3. The handler shares heavyweight state with concurrent topology rewrites. Both its paths (get_compact_tasks_impl, report_compact_tasks_impl) take compaction.write() + versioning.write() and run meta-store transactions, while the timer scheduler concurrently executes group splits/merges that mutate the same structures and cancel in-flight tasks (surfacing as compact task <id> not found on subsequent reports).

Observed production sequence (v2.8.3)

A large CREATE MATERIALIZED VIEW with backfill triggered a burst of GroupSchedulingSplit operations carving its high-throughput internal state tables into dedicated compaction groups (4 successful splits within 3 minutes on the same group lineage, plus one raced attempt failing with table X doesn't in group Y). Timeline (relative):

  • T+0s .. T+190s — split burst on the creating job's group lineage
  • T+196s — WARN compact task <id> not found (report for a task canceled by a split seconds earlier) — last compaction-related log line
  • T+196s .. T+63min — total silence: no dispatch, no acks, no errors. The main event loop is provably alive (it later logs stream events), and the hummock timer loop is provably alive (its periodic group-merge scan keeps logging). The connected compactor client's received-task count stayed at zero throughout.
  • T+~63min — the compactor client was restarted; the new instance registers fine (compactor <id> enters the cluster) but receives zero tasks — meta-side state still wedged
  • T+~74min — meta restart; the same client re-registers and dispatch resumes immediately

Deployment note: in this cluster the subscriber on the compaction event stream was a proxy component that pulls tasks on behalf of dynamically scaled compactor pods (RisingWave Cloud serverless compaction), not an in-tree compactor node. Meta treats any subscriber identically (add_compactor / event loop / dispatch), so the meta-side mechanism described here applies equally to plain compactor nodes; the ack-gating in point 2 is the in-tree compactor behavior.

Meanwhile a compaction group of the backfilling job crossed the L0 write-stop threshold (level0_stop_write_threshold_sub_level_number: 128 ≈ 128 checkpoints at 1s barrier interval). With dispatch dead, the write-stop could never clear: the write limiter (write_limiter.wait_permission) parked the backfill executors, exchange backpressure blocked upstream dispatchers (Output (actor …) in await trees), and barrier collection stalled cluster-wide until the meta restart.

Notes ruling out alternatives:

  • Not a failure of the compactor client: a freshly restarted instance registered and still got nothing.
  • Not the stream-error session leak fixed as a drive-by in #25283: the corresponding compactor stream poll with err log never fired.
  • Not a panic: the panic hook aborts the process (src/utils/runtime/src/panic_hook.rs), and meta survived until manually restarted.
  • Not "nothing scheduled": DynamicCompactionTrigger periodically re-marks all groups, and the timer loop kept running.
  • Not the versioning lock: the periodic merge scan kept acquiring it throughout the silence (tokio's RwLock is fair). The blocked await is therefore on the compaction lock, the compaction_group_manager lock, or a non-lock await (commit_multi_var / notification send) entered while racing the split's cancel-and-report path — not yet pinned exactly.

Reproduction

Two levels:

  1. Deterministic repro of the failure mode (the latch) — justifies the hardening fixes independently: add a failpoint that parks compact_task_dedicated_event_handler on one event. Observe the full production signature: no error logs, compactors idle forever, compactor restart doesn't help, meta restart does.
  2. Stress repro of the suspected race: three concurrent loops against one HummockManager — (a) split/merge the same group lineage via move_state_tables_to_dedicated_compaction_group, (b) report tasks including ones the splits just canceled, (c) pump PullTask events — assert dispatch keeps making progress. A short failpoint sleep between the compaction/versioning guard acquisitions in the report path widens the race window.

Suggested fixes (each independently useful)

  • Register the dedicated handler in await-tree and add a stall watchdog (log/alert when a single event exceeds N seconds).
  • Send PullTaskAck unconditionally or with a timeout so one lost ack cannot latch the pull protocol permanently.
  • Log when on_event_remotely forwarding fails (dead handler is currently invisible).
  • Expose a metric pair (compaction events consumed vs tasks dispatched) so "events arriving but nothing dispatched for N min with a live compactor" is alertable.

Related

  • #25283 — fixed an adjacent stream-error session leak in the same event loop (drive-by, not backported to 2.8.x; does not cover this).
  • #25813 — write limits are not refreshed after group rewrites; secondary aggravator here (the write-stop was computed for a group shape destroyed by a split seconds later), also worth backporting to 2.8.x.

Source: risingwavelabs/risingwave