Remove SIGTERM handler override in AM gather and send plugins - #1653
Remove SIGTERM handler override in AM gather and send plugins#1653robjarawan wants to merge 3 commits into
Conversation
Both gather/am.py and send/am.py override SIGTERM with SIG_DFL in __init__, which kills the process immediately on stop/restart. This bypasses the flow's graceful shutdown — on_stop callbacks, message acking, and connection cleanup are all skipped. Remove the override so the parent flow's signal handler runs properly.
|
I'm puzzled about how to test this... I'm not sure it has the effect hoped for. would want some testing. |
|
Fair point. The change is small -- just removing the SIG_DFL override so the parent flow's handler runs instead. The expected effect is that cleanup (closing sockets, stopping loops) actually happens on SIGTERM instead of an abrupt exit. I don't have an AM setup to test against but I can verify that the parent signal handler fires correctly with a mock. Would that be enough, or do you want to see it tested against an actual AM feed? |
|
Maybe @andreleblanc11 has some configs he can test this branch with? you need some AM flows, right? |
|
marking low priority because AM traffic is (gradually) being de-commissioned. so... yeah fine to fix it, but not super urgent. |
|
We added the signal handler to the AM code before Reid added it to the So I think it's probably OK to remove but will need to test. |
|
The diff itself is strictly safer: it only deletes the two One merge condition: a mock-handler smoke test, since bare fixtures do not construct ( The deeper items I found, the infinite accept loop with no stop check and the fork/execl orphan window, are pre-existing and I am marking them wontfix. AM is being decommissioned, so no loop rework is justified for a 6-line cleanup. @andreleblanc11 a live-flow eyeball on your side would still be welcome before merge. |
What
gather/am.pyandsend/am.pyboth override SIGTERM withSIG_DFLin__init__. This kills the process immediately onsr3 stop/restart, bypassing the flow's graceful shutdown —on_stopcallbacks, message acking, and connection cleanup are all skipped. Data loss on every stop/restart cycle.Change
Remove the
signal.signal(signal.SIGTERM, signal.SIG_DFL)call from both files so the parent flow's handler runs properly. Removed unusedsignalimport.