Skip to content

Log the graceful-stop error instead of silently discarding it in gracefulStopContainer - #1782

Merged
jglogan merged 1 commit into
apple:mainfrom
radheradhe01:fix/log-graceful-stop-error
Jun 23, 2026
Merged

Log the graceful-stop error instead of silently discarding it in gracefulStopContainer#1782
jglogan merged 1 commit into
apple:mainfrom
radheradhe01:fix/log-graceful-stop-error

Conversation

@radheradhe01

Copy link
Copy Markdown
Contributor

Closes #1756.

RuntimeService.gracefulStopContainer(_:signal:timeout:) wraps the graceful-stop attempt in do { … } catch {} — an empty catch that silently discards any thrown error before falling through to the unconditional lc.stop(). It is the only catch in this file that does not log; every other one uses self.log.error(…, metadata: ["error": "\(error)"]).

This adds a single log line matching that convention, so a failed graceful stop (and the resulting fall-through to a forced VM shutdown) is diagnosable. The intentional fall-through to lc.stop() is unchanged.

The catch around the graceful-stop attempt in gracefulStopContainer was empty, swallowing any error before the fall-through to lc.stop(). Add a log line matching the file convention.
@github-actions

Copy link
Copy Markdown

Code Coverage

Tier Line Coverage
Unit 33.4%
Integration 21.08%
Combined 53.63%

@jglogan jglogan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@radheradhe01 This looks good to me - thank you for adding that bit of observability.

@jglogan
jglogan merged commit 1d70dd6 into apple:main Jun 23, 2026
4 checks passed
stephenlclarke pushed a commit to stephenlclarke/container that referenced this pull request Jun 24, 2026
…efulStopContainer (apple#1782)

- Closes apple#1756.
- `RuntimeService.gracefulStopContainer(_:signal:timeout:)`
  wraps the graceful-stop attempt in `do { … } catch {}`. The
  empty catch silently discards any thrown error before falling
  through to the unconditional `lc.stop()`. It is the only catch
  in this file that does not log; every other one uses
  `self.log.error(…, metadata: ["error": "\(error)"])`.
- This adds a single log line matching that convention, so
  a failed graceful stop (and the resulting fall-through to a
  forced VM shutdown) is more diagnosable. The intentional
  fall-through to `lc.stop()` is unchanged.
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)

2 participants