fix(dgw): write boot.stacktrace file when running as a service#1838
Merged
Conversation
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
Contributor
There was a problem hiding this comment.
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_stacktracehelper. - Invokes
write_boot_stacktraceon 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.
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.
Member
Author
|
I reviewed Claude’s output, and it looks good to me. |
Philippe Latulippe (philippelatulippe)
approved these changes
Jun 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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