app-engine: say ByeBye on SIGTERM/SIGINT/SIGHUP too
QA finding 3. contracts C2's last row promises the sockets send `ByeBye` however the process ends, and the signal path only released the keys and the pointer. `ControlChannel` is `Sendable` and each of its methods hops to its own serial queue, so the handler can hold the channel and queue the goodbye itself without waking the Engine actor — which the header comment on `EmergencyRelease` forbids, and rightly. The 150 ms wait afterwards is the same grace `Engine.stop()` gives the packet (`InitAndCleanup.cs:192-215`); it is best effort, and it runs after the keys are already back. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This commit is contained in:
1 parent
ccbeff2e0a
commit
02df633a01
2 files changed
+43
No files matched your search
@@ -264,6 +264,7 @@ public actor Engine {
|
||||
try? await Task.sleep(for: .milliseconds(150))
|
||||
channel?.stop()
|
||||
channel = nil
|
||||
EmergencyRelease.shared.arm(channel: nil)
|
||||
tap?.stop()
|
||||
tap = nil
|
||||
health?.cancel()
|
||||
@@ -350,6 +351,9 @@ public actor Engine {
|
||||
let channel = ControlChannel(
|
||||
config: channelConfig(), sequencer: sequencer, replay: replay, sink: sink)
|
||||
self.channel = channel
|
||||
// The signal/atexit path may say `ByeBye` without waking this actor
|
||||
// (contracts C2, last row).
|
||||
EmergencyRelease.shared.arm(channel: channel)
|
||||
channel.start()
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user