GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — doh: keep pooled conns shorter-lived than server idle-timeouts; h2 PING health-checks by ShiroiKuma0 · Pull Request #242 · celzero/firestack

Conversation

@ShiroiKuma0

@ShiroiKuma0 ShiroiKuma0 commented Jul 17, 2026

Copy link
Copy Markdown

Fixes #241.

h2() pools DoH connections for 3 minutes (IdleConnTimeout) with no HTTP/2 keep-alive health-check. Several resolvers close idle DoH connections far sooner — measured from a fixed network, same day, reusing a TLS connection after an idle period:

resolver idle survived
dns.quad9.net EOF at ≤ 30 s
dns.mullvad.net EOF at ≤ 90 s
cloudflare-dns.com alive at > 240 s

With Quad9 (or any resolver whose idle timeout is under 3 minutes), every DNS lull longer than the server's idle window leaves the pool full of dead connections. The next queries are written into them, hang ~8–10 s, and surface as Post "…": unexpected EOF or http-status: 502; maxEOFTries often just picks the next dead pooled connection, so bursts of parallel queries fail together. Downstream on Android this expires alg mappings (realips([])), killing established flows of allowed apps, and fails the OS connectivity probes routed through the tunnel.

Change

Two adjustments in h2():

  1. IdleConnTimeout 3m → 10s — never keep a pooled connection longer than the shortest observed server-side idle window.
  2. http2.ConfigureTransports + ReadIdleTimeout = 10s / PingTimeout = 5s — actively evict half-dead h2 connections via PING instead of losing a query to them.

golang.org/x/net is already a module dependency, so the only new import is golang.org/x/net/http2.

Testing

Built from source and run on-device (Android, v055x/v055y engines). Same device, same resolver (Quad9), driven with worst-case traffic — bursts of 10 parallel uncached queries after guaranteed > 30 s idle gaps, ~40 cycles over 33 min:

  • Stock: query-failure bursts on nearly every cycle.
  • Patched: zero idle-pool failures; the log instead shows the health-check discovering and evicting each server-closed connection (retrier: read … err: EOF with no query error following), roughly one per idle cycle.

One caveat: with the PING enabled I saw a single rare stream error: stream ID N; PROTOCOL_ERROR reset taking out one burst on one connection (once in ~40 cycles; recovered on redial). If that turns out to be an interaction with the custom dialer, the IdleConnTimeout reduction alone already removes the corpse-pool state and may be the safer minimal change.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
白い熊 白い熊
doh: keep pooled conns shorter-lived than server idle-timeouts; h2 PI…
8288fb0
…NG health-checks

Some resolvers close idle DoH connections well under 30s (Quad9 measured
at <=30s from the same LAN; Cloudflare survives >240s). With the 3m
IdleConnTimeout, any DNS lull left only dead connections in the pool and
subsequent queries were written into them, hanging ~10s and surfacing as
'Post ...: unexpected EOF' / http-status 502 bursts (maxEOFTries retries
often just picked the next corpse). Downstream this expired alg mappings
(realips([])), killed established flows of allowed apps, and failed the
OS connectivity probes routed through the tunnel.

- IdleConnTimeout 3m -> 10s: never reuse a connection older than the
  shortest observed server-side idle window.
- http2.ConfigureTransports + ReadIdleTimeout/PingTimeout: actively
  evict half-dead h2 connections via PING instead of losing a query.
ignoramous
ignoramous reviewed Jul 18, 2026
View reviewed changes
Comment thread intra/doh/doh.go
// subsequent queries were written into them — hanging ~10s and dying with
// "unexpected EOF" / http-status 502 bursts (maxEOFTries retries often just pick the next
// corpse). Keep pooled connections shorter-lived than any observed server-side idle window.
IdleConnTimeout: 10 * time.Second,

@ignoramous ignoramous Jul 18, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

10s seems too low. Perhaps this could be et to 30s instead?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
ignoramous
ignoramous reviewed Jul 18, 2026
View reviewed changes
Comment thread intra/doh/doh.go
// Health-check h2 connections with PING frames so half-dead ones are evicted instead of
// eating a query first (net/http does not do this by default).
if t2, err := http2.ConfigureTransports(tr); err == nil && t2 != nil {
t2.ReadIdleTimeout = 10 * time.Second

@ignoramous ignoramous Jul 18, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Not sure what these are required for. Just the 30s idle timeout seems sufficient...?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
ignoramous
ignoramous requested changes Jul 18, 2026
View reviewed changes
@ignoramous ignoramous mentioned this pull request Jul 18, 2026
Frequent failures/slowdowns with sky.rethinkdns.com celzero/rethink-app#2896
Open
@ignoramous

ignoramous commented Jul 18, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Curious: Which model / agent did you use for this bug + commit?

Also: Will you please make corresponding changes to intra/dns53/dot.go, too?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ignoramous

ignoramous commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

7ece230

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ignoramous ignoramous closed this Jul 25, 2026
@vectorwren vectorwren mentioned this pull request Sep 23, 2026
fix(intra,ipn,dialers): restore proxyFor lock-read timeout and enforce read/write deadlines end-to-end #250
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@ignoramous ignoramous ignoramous requested changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

doh: pooled connections outlive resolver idle-timeouts — recurring "unexpected EOF" / 502 bursts (Quad9 kills idle conns at ≤30s vs 3m IdleConnTimeout)

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@ShiroiKuma0 @ignoramous
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.