Skip to content

Fix watchdog crashes on transient network errors#108

Merged
stelzo merged 6 commits intomainfrom
copilot/fix-watchdog-issue
Nov 26, 2025
Merged

Fix watchdog crashes on transient network errors#108
stelzo merged 6 commits intomainfrom
copilot/fix-watchdog-issue

Conversation

Copy link
Contributor

Copilot AI commented Nov 10, 2025

doduda listen terminates on any network error (timeouts, DNS failures, HTTP errors) because GetLatestLauncherVersion uses log.Fatal(). Since the API structure is stable (restarting works), the watchdog should survive transient failures and retry.

Changes

  • update.go: Refactored GetLatestLauncherVersion to return errors instead of calling log.Fatal()

    • Changed signature: func() stringfunc() (string, error)
    • Added safe type assertions with error checks to prevent panics on API structure changes
    • Added HTTP status code validation
    • Properly closes response body with defer
  • watchdog.go: Propagate errors up to watchdogTick which logs and continues

    if err != nil {
        log.Error(err)  // Logs but doesn't terminate
    }
  • main.go: Handle errors in versionCommand

Behavior

Before: Network error → process exits → manual restart required

After: Network error → logged → continues → retries on next interval (default 5min)

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • cytrus.cdn.ankama.com
    • Triggering command: curl -s REDACTED (dns block)
    • Triggering command: curl -v REDACTED (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Watchdog dies</issue_title>
<issue_description>doduda listen dies with unknown cause on the dofusdude server since one of the newest major updates to Dofus.

There is a hack running to ensure updates are reaching the servers but this problem should be taken care of soon.</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 5 commits November 10, 2025 16:53
Co-authored-by: stelzo <40026170+stelzo@users.noreply.github.com>
Co-authored-by: stelzo <40026170+stelzo@users.noreply.github.com>
Co-authored-by: stelzo <40026170+stelzo@users.noreply.github.com>
Co-authored-by: stelzo <40026170+stelzo@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix watchdog crash on dofusdude server Fix watchdog crashes on transient network errors Nov 10, 2025
Copilot AI requested a review from stelzo November 10, 2025 17:06
@stelzo stelzo marked this pull request as ready for review November 10, 2025 17:16
Copy link
Member

@stelzo stelzo left a comment

Choose a reason for hiding this comment

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

main.go L296 still is a log.Fatal, so how does this keep the server always running? @copilot

Copy link
Contributor Author

Copilot AI commented Nov 26, 2025

main.go L296 still is a log.Fatal, so how does this keep the server always running? @copilot

Line 296 is in versionCommand which handles the doduda version command - a one-shot command that prints the version and exits. It's appropriate to fail-fast there.

The watchdog (doduda listen) uses watchdogCommand (lines 355-428) which calls watchdogTick in a ticker loop. The key fix is in watchdogTick (watchdog.go:107-112) which now logs errors with log.Error(err) and continues running instead of crashing, allowing the watchdog to survive transient failures and retry on the next interval.

Copilot AI requested a review from stelzo November 26, 2025 17:08
@stelzo stelzo merged commit ab382aa into main Nov 26, 2025
7 checks passed
@stelzo stelzo deleted the copilot/fix-watchdog-issue branch November 26, 2025 17:13
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.

Watchdog dies

2 participants