No lock on DATA_DIR: two instances both run delivery recovery and both deliver #201
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Nothing prevents two processes from opening the same
DATA_DIR. Both open the same per-webhook SQLite files and both run delivery recovery over the same rows, so both deliver.Reproduced. Attempt counts per delivery, before and after a second process started:
Every attempt from the moment the second process came up was delivered twice to the destination. The second process in this reproduction was the non-serving zombie from the listen-failure issue filed alongside this one, but any double start or overlapping deploy does the same thing.
Duplicate delivery to a customer endpoint is the worst failure this product can have, and the trigger is a mundane operator slip.
Definition of done:
DATA_DIRat startup, held for the process lifetime, released on exitDATA_DIRrefuses to start and exits non-zero with a clear message naming the directorykill -9: verify a hard-killed process's lock does not block the next start (advisoryflockon an open fd gives this for free; a bare pidfile does not)kill -9succeeds