Skip to content

Preserve the Flow SIGTERM handler in AM callbacks - #164

Draft
robjarawan wants to merge 2 commits into
developmentfrom
fix/am-sigterm-handler-refresh
Draft

Preserve the Flow SIGTERM handler in AM callbacks#164
robjarawan wants to merge 2 commits into
developmentfrom
fix/am-sigterm-handler-refresh

Conversation

@robjarawan

Copy link
Copy Markdown
Owner

Fixes #163.

The AM gather and send callbacks were replacing the instance SIGTERM handler with SIG_DFL when they were constructed. So a normal SIGTERM killed the process immediately instead of calling Flow.stop_request() and letting the normal on_stop cleanup run.

So what I did was leave the instance handler in place. I added a regression test that starts a real child process, installs sarracenia.instance.instance.stop_signal, constructs each real AM callback, and sends the child an actual SIGTERM.

Before this change, both children reported parent_handler_preserved: false, returned no shutdown result, and exited with -15. After the change, both callbacks preserve the handler, request the Flow stop, close their sockets, and exit with 0.

I also checked this together with the existing partial-send fix from #119. That commit applies cleanly and all 22 combined AM tests pass.

Tests:

  • tests/sarracenia/flowcb/am_signal_test.py: 2 passed
  • focused AM tests: 20 passed
  • combined with fix: send complete AM frames over TCP #119: 22 passed
  • broader suite excluding the unavailable Azure fixture: 356 passed, 1 skipped
  • local maintenance flow: PASS, 5 messages received and downloaded, queues/configurations cleaned up

This branch also includes the local-fixture CI repair from #140 so the fork maintenance jobs do not depend on public dynamic flows.

Related upstream work: MetPX#1653. I have left that upstream PR unchanged; this draft is based on the current fork development branch and contains the stronger real-signal regression proof.

@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown

Test Results

376 tests   375 ✅  1m 44s ⏱️
  1 suites    1 💤
  1 files      0 ❌

Results for commit 05b1095.

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.

AM callbacks replace the Flow SIGTERM handler

1 participant