Skip to content

bug(pipeline): digest never drains on channel close; events lost on shutdown #331

Closed

Description

@ajianaz

Problem

  1. crates/trapfalld/src/digest.rs:47-67: Some(event) = self.rx.recv() only disables its select branch when the channel closes; the interval branch is always ready so else never fires and the loop never exits.
  2. crates/trapfalld/src/main.rs:249-255: axum::serve has no with_graceful_shutdown; after it returns, digest_handle.abort() kills the task without a final flush.

Impact

Events already acked with HTTP 200 (up to 50 in batch + queued in the 1024 mpsc) are lost on SIGTERM/restart/deploy.

Fix

  • match self.rx.recv().await { None => { flush; break } Some(e) => ... } inside the select.
  • Handle ctrl_c/SIGTERM, graceful shutdown, drop ingest_tx, then digest_handle.await instead of abort().
  • Add a test: send N events, close channel, assert all persisted.

Found in static audit of develop @ db3ca67.

Activity

  1. added a commit that references this issue on Oct 13, 2026
    e3918e4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority:criticalP0 - Must fix immediately

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions