Problem
A .wasm binary that causes the Wasmtime executor to panic or trap before it can write any
result will be re-queued by the Reaper indefinitely, creating an infinite crash loop that
consumes executor capacity and pollutes logs with noise.
Proposed Solution
Track a separate recovery_count column incremented by the Reaper each time it re-queues a
job (distinct from attempt, which is incremented at claim time). If recovery_count reaches
a configurable threshold (default 3) the job is moved to dead with an explanatory error
message, regardless of remaining max_attempts.
ALTER TABLE jobs
ADD COLUMN recovery_count INT NOT NULL DEFAULT 0;
Reaper update for re-queued jobs:
UPDATE jobs
SET
status = 'pending',
claimed_at = NULL,
claimed_by = NULL,
heartbeat_at = NULL,
recovery_count = recovery_count + 1
WHERE status = 'running'
AND COALESCE(heartbeat_at, claimed_at) < NOW() - visibility_timeout
AND attempt < max_attempts
AND recovery_count < $1 -- MATE_POISON_PILL_THRESHOLD
RETURNING id;
-- Quarantine poison pills
UPDATE jobs
SET
status = 'dead',
result = '{"error":"poison pill: executor crashed without recording a result 3 times"}'::jsonb
WHERE status = 'running'
AND COALESCE(heartbeat_at, claimed_at) < NOW() - visibility_timeout
AND recovery_count >= $1;
The threshold should be configurable via MATE_POISON_PILL_THRESHOLD (default 3).
Acceptance Criteria
Problem
A
.wasmbinary that causes the Wasmtime executor to panic or trap before it can write anyresult will be re-queued by the Reaper indefinitely, creating an infinite crash loop that
consumes executor capacity and pollutes logs with noise.
Proposed Solution
Track a separate
recovery_countcolumn incremented by the Reaper each time it re-queues ajob (distinct from
attempt, which is incremented at claim time). Ifrecovery_countreachesa configurable threshold (default
3) the job is moved todeadwith an explanatory errormessage, regardless of remaining
max_attempts.Reaper update for re-queued jobs:
The threshold should be configurable via
MATE_POISON_PILL_THRESHOLD(default3).Acceptance Criteria
recovery_countcolumn added via migration.recovery_counton each re-queue (not on normal retry).deadwith a descriptiveresultJSON whenrecovery_countreachesthe configured threshold.
MATE_POISON_PILL_THRESHOLDenvironment variable is documented in.env.example.