Skip to content

Log graceful-stop errors instead of silently swallowing them#1777

Open
LynxBay wants to merge 1 commit into
apple:mainfrom
LynxBay:fix/graceful-stop-error-logging
Open

Log graceful-stop errors instead of silently swallowing them#1777
LynxBay wants to merge 1 commit into
apple:mainfrom
LynxBay:fix/graceful-stop-error-logging

Conversation

@LynxBay

@LynxBay LynxBay commented Jun 21, 2026

Copy link
Copy Markdown

Summary

gracefulStopContainer wrapped its signal/timeout/kill logic in an empty catch {}, silently discarding any failure that occurred while attempting a graceful stop (for example, failing to obtain the container's exit code). The vm is still powered off on the next line, so the error is not fatal — but the swallowed error left graceful-stop failures with no trace in the logs, making them impossible to diagnose.

Fixes #1756.

Change

Replace the empty catch {} in Sources/Services/RuntimeLinux/Server/RuntimeService.swift with an error log, matching the error logging already used by cleanUpContainer in the same file:

} catch {
    self.log.error("failed to gracefully stop container", metadata: ["error": "\(error)"])
}

Control flow is otherwise unchanged: the caught error remains non-fatal and the vm is still powered off. The only behavioral change is that the error is now observable.

Verification

  • swift build --target ContainerRuntimeLinuxServer — builds clean (RuntimeService.swift compiles).

🤖 Generated with Claude Code

gracefulStopContainer wrapped its signal/timeout/kill logic in an empty catch {}, discarding any failure (for example, failing to obtain an exit code). The vm is still powered off afterwards, but the swallowed error left graceful-stop failures with no trace.

Log the error so failures are observable, matching the existing error logging in cleanUpContainer in the same file.

Closes apple#1756

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

gracefulStopContainer silently swallows the graceful-stop error in an empty catch {} (no log)

1 participant