Repository navigation
Conversation
klesgidis
requested review from
echetzakis,
kzacharakis,
nikosd23 and
stavros-wb
as code owners
October 29, 2026 11:18
stavros-wb
approved these changes
Oct 30, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
How we identified
A consumers pod received SIGTERM while it was creating a HelloSign signature request. The process exited immediately, before that handler finished and before Kafka committed the offset.
HelloSign had already created the request and sent
signature_request_sent. The pg-boss job looked up the employee document by that request id, found nothing, and failed after three retries. Kafka then redelivered the same message to another pod, which created a second request and saved that one. The employee got two signing emails. Only the second is linked in HRIS.What happened
The exit was not a graceful shutdown. orka's SIGTERM handler is registered with
process.onceand does not wait fordisconnect(). Once it runs, the listener is gone. Honeybadger then sees no other SIGTERM listener and callsprocess.exit(). The in-flight handler is killed instead of being allowed to finish and commit.After the change
The handler now stays registered, waits for every consumer to finish and commit, then disconnects the producer. The wait is capped by
kafka.shutdownTimeoutMs(default 25 seconds).shutdownKafka()is exported for the app to await before it exits. Consumers are tracked in aSet, because the oldMapwas keyed by group ID and dropped an earlier consumer that shared one.