Catalogue / incidentio-2022-poison-pill-crashes

A poison-pill Pub/Sub message panicked in a goroutine the recover did not cover and repeatedly crashed incident.io's single-binary Go monolith on Heroku

incident.io, 2022. Incident.io application (Go monolith on Heroku).

Organisation
incident.io
Evidence
Incident report
System
incident.io application (Go monolith on Heroku)
Setup
One database

Near: Heroku Postgres as a database

As of
2022-11
Source
Intermittent downtime from repeated crashes

incident.io blog, published 2022-11-30 (Read from the Internet Archive copy captured on 2026-05-20; the live page timed out.)

Architecture

The app is a Go monolith on Heroku, with Heroku Postgres as its database and GCP Pub/Sub as an async message queue. At the time of the incident a single binary ran the web, worker and cron threads together.

Section: Background

Components

ComponentRoleWhere
Go monolith on HerokuOne binary, deployed with the container buildpack, running web, worker and cron threads. The three were logically separate, with their own database connection pools and command line flags to switch each on or off.Section: Background | Near: each component used separate database connection pools
Heroku PostgresThe application's database.Section: Background
GCP Pub/Sub subscriptionsCarry async work to message handlers inside the app. When a handler returns an error, Pub/Sub applies back-off before redelivering the message. Async events are treated as best-effort.Section: Background | Near: we treat async events as best-effort
Panic handlersWrap every entry point (web requests, Pub/Sub messages, cron jobs), with the aim that an unhandled panic does not take the app down. The one in the generic Pub/Sub consumer did not cover the goroutines the client library starts.Near: are wrapped in panic handlers to prevent | Section: Mitigation 1: Ensuring we handle message panics

Figures, as the source states them

FigureAs statedNoteWhere
Downtime13 minutesSpread over a period of 32 minutesNear: we experienced 13 minutes of downtime
Goroutines the application runs with300 goroutinesApproximatelyNear: As our application runs with ~300 goroutines

Records

Failure#f1

One bad queue message crashed the whole process each time it was consumed, taking web traffic down with the workers

incidentio-2022-poison-pill-crashes#f1 at corpus version 26a1b3a7e3dd
Trigger

At 15:40 GMT on Friday 18th November 2022 the app crashed with Heroku's H10 error. The message responsible sat on the subscription that generates a welcome message when people first enter an incident channel; for a very small subset of customers that code ran in a way that made it fail.

Near: On Friday 18th November 2022 | Section: Initial crash | Section: Regroup

How it failed

The generic event consumer had a recover, but the Pub/Sub client's Receive starts new goroutines to run the handler, and a panic in a child goroutine is not caught by a recover in its parent, so the whole app crashed. Heroku restarts a dyno at once after a first crash, but further crashes wait through a cool-off of up to 20m; monitoring suggested the app had crashed again quickly after the first restart, so engineers rebooted it by hand at 15:42, and did so again as further crashes followed.

Section: Mitigation 1: Ensuring we handle message panics | Section: Initial crash | Section: Subsequent crashes

Why defences did not hold

Panic handlers were added all over the app, but this edge case in the common consumer was missed. Diagnosis was slow: a Go panic prints the stack of every goroutine, and with ~300 of them Heroku buffered and dropped the log lines, hiding the crashing stack trace; Go exits at once on an unhandled panic, so Sentry error reporting was terminated as well; and Heroku's log rate limiting also hit the lines just before each crash.

Section: Mitigation 1: Ensuring we handle message panics | Section: Subsequent crashes

Impact

The app was down for 13 minutes in total within a 32 minute window, between 15:40 and 16:12 GMT. During recovery several non-critical features that trigger async work, such as incident nudges, were turned off, and all events on the purged subscriptions were dropped.

Near: we experienced 13 minutes of downtime | Section: Subsequent crashes

Fix

During the incident engineers restarted dynos by hand, purged every subscription with unacked messages from around the first crash, and turned off non-critical features that trigger async work; the app was stable from 16:12. A recover in the shared message handler was deployed at 16:48, and by 17:24 web, worker and cron ran as separate dynos.

Section: Subsequent crashes | Section: Mitigation 1: Ensuring we handle message panics | Section: Mitigation 2: Separate our app by work type

Decision#d1

Run web, worker and cron as separate dynos instead of threads of one binary

incidentio-2022-poison-pill-crashes#d1 at corpus version 26a1b3a7e3dd
Chosen

A new worker dyno tier was added in Heroku and each entrypoint adjusted, so that web requests, async workers and cron jobs run physically apart.

Section: Mitigation 2: Separate our app by work type

What forced it

The incident, in which a panic in async message handling crashed the single binary and with it web traffic. The post calls an incident like this the clear push the team had been waiting for.

Near: so we'd been waiting for a clear push | Section: Mitigation 1: Ensuring we handle message panics

Reasoning

Of the reasons the post lists for separating work types, the one the team says it cares about is that badly behaving work, such as a panic, cannot adversely affect the rest. Had async work been apart from web traffic, the authors say, they would have kept serving Slack interactions and the web dashboard even with the workers dead.

Near: In our case (3) is what we care

What worked before

One binary ran everything, with a clear logical separation already in place: separate code, separate database connection pools per component, and flags to toggle each. The split had been started but left unfinished because the team had most of the value from the logical separation, prefers running as simple an app as possible, and expected another dyno to increase CI times slightly.

Near: We had begun the process of splitting | Near: The reason we hadn't completed the split

Outcome

The split was running in production by 17:24 on the day of the incident.

Near: By 17:24, this change was running in production

Decision#d2

Purge the subscriptions holding unacked messages from around the first crash instead of rolling back the last deploy

incidentio-2022-poison-pill-crashes#d2 at corpus version 26a1b3a7e3dd
Chosen

Unable to find the bad message, the team purged all events from every subscription that had unacked messages from around the time of the first crash, and switched off several non-critical features that trigger async work.

Near: we purge the subscription, removing all the events | Near: We also turn off several non-critical parts

Rejected

Roll back the last deploy. The crash came about 15m after the last deploy, so a frequently used event was unlikely to be the cause, and without knowing what introduced the bug a rollback was unlikely to fix it.

Near: rolling back is therefore unlikely to fix

What forced it

The app kept crashing, and after 5m of trying, the team had failed to get usable logs showing which event was responsible.

Near: After 5m of trying and failing to retrieve

Reasoning

The team treats async events as best-effort, so dropping them only degrades service, which it preferred if it brought the app back up. It reasoned that the first crash was probably the first time the bad event was processed.

Near: we treat async events as best-effort | Near: We conclude the original crash was probably

Cost

Every event on the purged subscriptions was removed from the queue, and several non-critical features that trigger async work, such as incident nudges, were switched off.

Near: we purge the subscription, removing all the events | Near: We also turn off several non-critical parts

Outcome

At 16:12, after several subscriptions had been purged, the app stopped crashing and stayed stable without further intervention.

Near: At 16:12, after purging several subscriptions

Review

Extracted by
Claude (feed 26)
Human review
Not started. Status recorded on 2026-12-02.