GitHub
04/30/2026, 1:07 PM_handling_sigterm terminates job before graceful termination is complete
Issue created by ralichkov
Meltano Version
4.1.2
Python Version
None
Bug scope
CLI (options, error messages, logging, etc.)
Operating System
MacOS & Linux
Description
Recently I've been interested in the graceful termination functionality introduced in singer-sdk v0.47 with this PR. I think the implementation is elegant and the SDK part works great!
When testing this out both on my local machine and in production, I find that when Meltano receives SIGTERM the job terminates before the plugins have finished their part of "graceful termination". Using SIGINT allows the plugins to fully exit, though.
I find that the root cause for this is the SystemExit exception thrown in the handler function called in _handling_sigterm. By removing it, i was able to achieve the desired behavior.
def handler(*_) -> t.NoReturn:
sigterm_status = 143
- raise SystemExit(sigterm_status)
I'm not experienced with async programming, so I can't tell whether this is the correct direction, or whether this handler is needed at all.
Link to Slack/Linen
https://meltano.slack.com/archives/C069CQNHDNF/p1777474335620629
meltano/meltano