Skip to content

fix(dns): add timeout context for DBus checkResolved calls#4165

Open
hklcf wants to merge 1 commit into
SagerNet:testingfrom
hklcf:fix/dbus-context-timeout
Open

fix(dns): add timeout context for DBus checkResolved calls#4165
hklcf wants to merge 1 commit into
SagerNet:testingfrom
hklcf:fix/dbus-context-timeout

Conversation

@hklcf
Copy link
Copy Markdown

@hklcf hklcf commented May 23, 2026

Description

The \checkResolved\ method in \local_resolved_linux.go\ was called with \context.Background()\ from both \Exchange()\ and \updateStatus(), passing it into \CallWithContext()\ for DBus operations. This meant there was no application-level timeout or cancellation mechanism.

Fix

Wrap the context with \context.WithTimeout\ using \C.DNSTimeout\ (10s) before passing to \checkResolved(). If the DBus operation hangs, the timeout ensures the call returns instead of blocking indefinitely.

Related Issue

Fixes #4160

Use context.WithTimeout with DNSTimeout (10s) instead of bare
context.Background() when calling checkResolved via DBus.
If systemd-resolved or the DBus daemon becomes unresponsive,
the call would previously block indefinitely.

Fixes SagerNet#4160
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.

Bug: DBus resolved resolver uses context.Background() with no timeout, can block indefinitely

1 participant