Skip to content

fix(dgw): write boot.stacktrace file when running as a service#1838

Merged
Benoît Cortier (CBenoit) merged 2 commits into
masterfrom
claude/slack-session-vn33pv
Jun 26, 2026
Merged

fix(dgw): write boot.stacktrace file when running as a service#1838
Benoît Cortier (CBenoit) merged 2 commits into
masterfrom
claude/slack-session-vn33pv

Conversation

@CBenoit

@CBenoit Benoît Cortier (CBenoit) commented Jun 26, 2026

Copy link
Copy Markdown
Member

When Devolutions Gateway failed to start as a Windows service — for example because of an invalid TLS certificate or PFX file loaded before logging is initialized — no diagnostic was produced: the failure surfaced only as an SCM "service started then stopped" with no log line and no boot.stacktrace file. The boot.stacktrace file is now also written on service-mode startup failures, mirroring the behavior already present in CLI/foreground mode, so the underlying error is captured even when the logging subsystem never came up.

Issue: DGW-401


Generated by Claude Code

Previously the boot.stacktrace file was only written when Gateway ran in
foreground/CLI mode. In Windows service mode, startup failures inside
gateway_service_main (config init, service load, service start) only
emitted a Windows event-log entry and returned an SCM error code, so no
boot.stacktrace was produced even when the logging subsystem never came
up. The boot.stacktrace-writing logic is now factored into a reusable
helper and invoked from each service-mode startup-failure branch, in
addition to the existing event-log reporting.

Issue: DGW-401

Copilot AI 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.

Pull request overview

This PR ensures startup failures when running Devolutions Gateway as a Windows service still produce a boot.stacktrace diagnostic file, aligning service-mode behavior with the existing foreground/CLI failure handling so early-boot errors are captured even when logging never initializes.

Changes:

  • Refactors the boot stacktrace writing logic into a dedicated write_boot_stacktrace helper.
  • Invokes write_boot_stacktrace on service-mode startup failure paths (config init, service load, service start).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread devolutions-gateway/src/main.rs
Per review feedback on DGW-401: write_boot_stacktrace assumed the data
directory already existed. In service mode the eprintln fallback is not
visible, so a missing directory silently lost the diagnostic file. Now
create_dir_all is attempted (best-effort) before the write.
@CBenoit

Benoît Cortier (CBenoit) commented Jun 26, 2026

Copy link
Copy Markdown
Member Author

I reviewed Claude’s output, and it looks good to me.

@CBenoit Benoît Cortier (CBenoit) merged commit 48a8512 into master Jun 26, 2026
82 of 84 checks passed
@CBenoit Benoît Cortier (CBenoit) deleted the claude/slack-session-vn33pv branch June 26, 2026 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants