[SIGNIFICANT] Shutdown doesn't wait for services to actually stop #24

Open
opened 2026-05-11 10:52:01 +00:00 by thabeta · 1 comment
Owner

Problem

In main.rs, shutdown calls supervisor.stop_all_services().await and then immediately after the select arm completes:

  1. ipc_handle.abort() -- kills the IPC server
  2. command_handle.abort() -- kills the command handler
  3. Socket file is removed

The stop_all_services method sends stop events to the event queue and returns -- it does NOT wait for services to actually exit. The supervisor's event loop exits when shutdown = true, so stop events in the queue may never be processed.

Impact

Services are killed abruptly during shutdown without graceful termination. Data loss, corrupted state, and incomplete cleanup. This defeats the purpose of ordered shutdown.

Files

  • crates/my_init_server/src/main.rs -- shutdown select block

Suggested Fix

  • Wait for all services to reach terminal state (Exited/Failed/Inactive) before aborting handles
  • Add a shutdown timeout with force-kill fallback
## Problem In `main.rs`, shutdown calls `supervisor.stop_all_services().await` and then immediately after the select arm completes: 1. `ipc_handle.abort()` -- kills the IPC server 2. `command_handle.abort()` -- kills the command handler 3. Socket file is removed The `stop_all_services` method sends stop events to the event queue and returns -- it does NOT wait for services to actually exit. The supervisor's event loop exits when `shutdown = true`, so stop events in the queue may never be processed. ## Impact Services are killed abruptly during shutdown without graceful termination. Data loss, corrupted state, and incomplete cleanup. This defeats the purpose of ordered shutdown. ## Files - `crates/my_init_server/src/main.rs` -- shutdown select block ## Suggested Fix - Wait for all services to reach terminal state (Exited/Failed/Inactive) before aborting handles - Add a shutdown timeout with force-kill fallback
Member

Classification: valid-bug — stop_all_services returns before services actually stop; then handles are aborted immediately, killing services without graceful termination.

The issue description referencing crates/my_init_server/src/main.rs confirms that the shutdown select block calls supervisor.stop_all_services().await which sends stop events to the event queue but does not await their completion. The IPC and command handles are aborted immediately after.

> Classification: valid-bug — stop_all_services returns before services actually stop; then handles are aborted immediately, killing services without graceful termination. The issue description referencing crates/my_init_server/src/main.rs confirms that the shutdown select block calls supervisor.stop_all_services().await which sends stop events to the event queue but does not await their completion. The IPC and command handles are aborted immediately after.
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
geomind_code/my_init#24
No description provided.