Skip to content

Navigation breaks after system sleep/resume - pages load indefinitely #61

@bnema

Description

@bnema

Bug Description

After the system goes to sleep and resumes, if dumber browser was open, navigation (both within a site and to external sites) stops working. Pages load indefinitely and the browser must be restarted to recover.

Observed while browsing github.com on a laptop.

Root Cause Analysis

After investigating the codebase, the issue is that dumber has no handling for system sleep/wake events. Several potential causes:

1. No Sleep/Wake Event Listening

The application doesn't know when the system goes to sleep or wakes up. There's no listener for:

  • org.freedesktop.login1.Manager.PrepareForSleep(bool going_to_sleep) D-Bus signal

2. Stale Network/WebKit State

After resume:

  • WebKit network sessions may hold stale connections
  • DNS cache may be invalid
  • TLS sessions may have expired
  • The NetworkSession in internal/infrastructure/webkit/context.go is created once and never refreshed

3. No Web Process Crash Recovery

If WebKit's web process becomes unresponsive after sleep, there's no handling:

  • No web-process-crashed or web-process-terminated signal handlers
  • No automatic reload or error page mechanism

Current Related Code

  • internal/infrastructure/idle/portal_inhibitor.go - Only prevents sleep (for video playback), doesn't react to sleep/wake
  • internal/infrastructure/webkit/context.go - Single shared NetworkSession, no refresh mechanism
  • internal/infrastructure/webkit/webview.go - No web process crash signal handlers

Proposed Solutions

Option A: Listen for PrepareForSleep (Recommended)

  1. Add D-Bus listener for org.freedesktop.login1.Manager.PrepareForSleep
  2. On wake (PrepareForSleep(false)):
    • Optionally trigger page reload for active tabs
    • Or at minimum, log the event for debugging

Option B: Add Web Process Crash Handling

  1. Connect to WebKit's web-process-terminated signal
  2. Show error page with reload option when web process dies
  3. Optionally auto-reload

Option C: Network State Monitoring

  1. Monitor org.freedesktop.portal.NetworkMonitor for connectivity changes
  2. Refresh stale connections after network returns

Workaround

Restart the browser after system resume.

Environment

  • Linux laptop with system sleep/hibernate
  • Site: github.com (but likely affects all sites)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions