mirror of
https://github.com/xcat2/confluent.git
synced 2026-09-05 04:27:56 +00:00
3563da041b
terminate() called sys.exit(0) from a signal handler while the asyncio loop was running. The SystemExit escaped run_forever, and closing the loop afterwards then failed with "Cannot close a running event loop", so every clean stop wrote a cascade of tracebacks and left a pending task behind. Ask the loop to stop instead: deliver the signals through add_signal_handler, which is the signal safe route, and set an event the main coroutine waits on so that it returns and asyncio can unwind itself. Flush configuration on the way out, as the client requested shutdown has always done. That client requested shutdown went the same way, calling sys.exit from inside a request coroutine, and it is the route the systemd unit uses to stop the service. It now asks for the same orderly stop through a hook the running service registers, keeping the old behaviour when nothing is registered. Measured on all three routes, with redfish and ipmi sessions to a bmc in flight: under a third of a second and no tracebacks, where before each one wrote a cascade.