Skip to content

Prevent continuous connection rebuilding in custom upstreams #7789

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fbernier
Copy link

@fbernier fbernier commented Apr 25, 2025

This commit fixes a critical performance issue with custom encrypted DNS upstreams configured for persistent clients. The bug caused connections to be unnecessarily closed and rebuilt on every DNS request, making custom DoH/DoT/DoQ upstreams 4-5 times slower than global upstreams.

The root cause was that after rebuilding a client's upstream connection, the timestamp commonConfUpdate used for detecting configuration changes was never updated. This resulted in an endless cycle of detecting "changes" and rebuilding connections on every request, particularly impacting encryption protocols with expensive connection establishment.

This PR updates the client's configuration timestamp after rebuilding the connection in upstreamManager.customUpstreamConfig().

Fixes: #7739, #7769

Disclaimer: I have yet to test this. I don't have the time right now but will do later. If anyone else want to give this a try, please do.

edit: I've actually tested it now and I have not encountered the issue since then.

This commit fixes a critical performance issue with custom encrypted DNS
upstreams configured for persistent clients. The bug caused connections
to be unnecessarily closed and rebuilt on every DNS request, making
custom DoH/DoT/DoQ upstreams 4-5 times slower than global upstreams.

The root cause was that after rebuilding a client's upstream connection,
the timestamp (commonConfUpdate) used for detecting configuration changes
was never updated. This resulted in an endless cycle of detecting "changes"
and rebuilding connections on every request, particularly impacting
encryption protocols with expensive connection establishment.

This PR updates the client's configuration timestamp after rebuilding the
connection in upstreamManager.customUpstreamConfig().

Fixes: AdguardTeam#7739, AdguardTeam#7769
@bohtho
Copy link

bohtho commented Apr 26, 2025

Can we get this merged into edge?

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.

Issues with QUIC upstreams
2 participants