Skip to content

Deploy: restart the worker set as one unit, verify the inbound drain, unbuffer worker logs - #82

Open
alexeygrigorev wants to merge 1 commit into
mainfrom
ops/inbound-email-drain-restart
Open

alexeygrigorev wants to merge 1 commit into
mainfrom
ops/inbound-email-drain-restart

Conversation

@alexeygrigorev

Copy link
Copy Markdown
Member

Closes the datamailer-side ops gap from the Oct 10-13 inbound-email outage (27 messages dead-lettered over three days while the inbound drain sat stale).

What happened. After the Oct 10 deploy, datamailer-db-worker was fresh but datamailer-inbound-email-worker was still running code from Oct 1; its enqueue path failed deterministically and every inbound message was retried maxReceiveCount times into the DLQ. The install script has restarted all workers since 754d940 (Aug 7) under set -euo pipefail, so the evidence (db-worker restarted Oct 10 06:15, drain still "active since Oct 1") means the restart batch aborted between units - and the deploy went red mid-script without anyone connecting that to the stale drain. The post-deploy is-active list did not check the drain at all, and the drain's block-buffered stdout hid three days of received=1 deleted=0 failed=1 lines until the manual restart flushed them.

Changes

  • scripts/install_sandbox_worker_service.sh: restart all five worker units in a single systemctl restart transaction - every unit gets a restart attempt even if another fails, and the existing systemctl is-active block still fails the script when a unit did not come up. All worker units now run with PYTHONUNBUFFERED=1 so failures land in journald immediately.
  • .github/workflows/deploy-sandbox.yml: add datamailer-inbound-email-worker to the post-deploy is-active verification, so a stale or dead drain fails the deploy instead of passing silently.

Sandbox-only (this repo has no production environment).

The Oct 10 deploy left datamailer-inbound-email-worker running Oct 1 code
while db-worker got the fresh deploy: the restart batch ran under set -e,
so one failing unit between them orphaned the rest, and nothing in the
deploy path verified the drain afterwards. Restart all worker units in a
single transaction, verify the inbound drain post-deploy, and run the
workers with PYTHONUNBUFFERED=1 so failures reach journald immediately.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant