[net] http2: make the error channel pool per-Server

2 views
Skip to first unread message

Damien Neil (Gerrit)

unread,
Sep 30, 2025, 8:16:05 PM (yesterday) Sep 30
to goph...@pubsubhelper.golang.org, Brad Fitzpatrick, Go LUCI, golang-co...@googlegroups.com
Attention needed from Brad Fitzpatrick

New activity on the change

Open in Gerrit

Related details

Attention is currently required from:
  • Brad Fitzpatrick
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: net
Gerrit-Branch: master
Gerrit-Change-Id: I966f985e1b9644bdf8ae81d9abb142d80320cc82
Gerrit-Change-Number: 708135
Gerrit-PatchSet: 1
Gerrit-Owner: Damien Neil <dn...@google.com>
Gerrit-Reviewer: Brad Fitzpatrick <brad...@tailscale.com>
Gerrit-Reviewer: Damien Neil <dn...@google.com>
Gerrit-Attention: Brad Fitzpatrick <brad...@tailscale.com>
Gerrit-Comment-Date: Wed, 01 Oct 2025 00:16:01 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
unsatisfied_requirement
satisfied_requirement
open
diffy

Brad Fitzpatrick (Gerrit)

unread,
Sep 30, 2025, 10:25:35 PM (yesterday) Sep 30
to Damien Neil, goph...@pubsubhelper.golang.org, Brad Fitzpatrick, Go LUCI, Brad Fitzpatrick, golang-co...@googlegroups.com
Attention needed from Brad Fitzpatrick and Damien Neil

Brad Fitzpatrick voted and added 2 comments

Votes added by Brad Fitzpatrick

Code-Review+2

2 comments

File http2/server.go
Line 221, Patchset 1 (Latest): return make(chan error, 1) // Server used without calling ConfigureServer
Brad Fitzpatrick . unresolved

maybe revert to the package global variable form like before in this case? otherwise if this is a valid way to use a Server, it could be a surprising performance difference

Line 247, Patchset 1 (Latest): errChanPool: sync.Pool{New: func() interface{} { return make(chan error, 1) }},
Brad Fitzpatrick . unresolved

do we not use "any" in x/ repos yet?

Open in Gerrit

Related details

Attention is currently required from:
  • Brad Fitzpatrick
  • Damien Neil
Submit Requirements:
  • requirement satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: net
Gerrit-Branch: master
Gerrit-Change-Id: I966f985e1b9644bdf8ae81d9abb142d80320cc82
Gerrit-Change-Number: 708135
Gerrit-PatchSet: 1
Gerrit-Owner: Damien Neil <dn...@google.com>
Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
Gerrit-Reviewer: Brad Fitzpatrick <brad...@tailscale.com>
Gerrit-Reviewer: Damien Neil <dn...@google.com>
Gerrit-Attention: Brad Fitzpatrick <brad...@tailscale.com>
Gerrit-Attention: Damien Neil <dn...@google.com>
Gerrit-Comment-Date: Wed, 01 Oct 2025 02:25:30 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Brad Fitzpatrick (Gerrit)

unread,
10:56 AM (12 hours ago) 10:56 AM
to Damien Neil, goph...@pubsubhelper.golang.org, Brad Fitzpatrick, Go LUCI, Brad Fitzpatrick, golang-co...@googlegroups.com
Attention needed from Brad Fitzpatrick and Damien Neil

Brad Fitzpatrick added 1 comment

File http2/server.go
Line 221, Patchset 1 (Latest): return make(chan error, 1) // Server used without calling ConfigureServer
Brad Fitzpatrick . unresolved

maybe revert to the package global variable form like before in this case? otherwise if this is a valid way to use a Server, it could be a surprising performance difference

Brad Fitzpatrick

Or can we put a sync.Once on serverInternalState and add an errChanPool accessor method that does the lazy init, removing it from ConfigureServer?

Gerrit-Comment-Date: Wed, 01 Oct 2025 14:56:43 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Brad Fitzpatrick <brad...@golang.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Damien Neil (Gerrit)

unread,
12:12 PM (10 hours ago) 12:12 PM
to goph...@pubsubhelper.golang.org, Nicholas Husin, Brad Fitzpatrick, Go LUCI, Brad Fitzpatrick, golang-co...@googlegroups.com
Attention needed from Brad Fitzpatrick and Nicholas Husin

Damien Neil added 2 comments

File http2/server.go
Line 221, Patchset 1: return make(chan error, 1) // Server used without calling ConfigureServer
Brad Fitzpatrick . resolved

maybe revert to the package global variable form like before in this case? otherwise if this is a valid way to use a Server, it could be a surprising performance difference

Brad Fitzpatrick

Or can we put a sync.Once on serverInternalState and add an errChanPool accessor method that does the lazy init, removing it from ConfigureServer?

Damien Neil

Good thought on reverting to package global. Did that.

The `s == nil` case occurs when `Server.state` is uninitialized (nil). We'd need a way to lazily set `Server.state`, which is tricky: We could make it atomic (probably no real performance cost, since it'd be mostly uncontended?), or we could make an unsynchronized initialization in `Server.serveConn` (probably fine, but could cause race conditions for some people).

I'd rather not figure any of that out right now.

Line 247, Patchset 1: errChanPool: sync.Pool{New: func() interface{} { return make(chan error, 1) }},
Brad Fitzpatrick . resolved

do we not use "any" in x/ repos yet?

Damien Neil

We do, but we haven't done a cleanup pass to change existing `interface {}`s.

Open in Gerrit

Related details

Attention is currently required from:
  • Brad Fitzpatrick
  • Nicholas Husin
Submit Requirements:
  • requirement satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: net
Gerrit-Branch: master
Gerrit-Change-Id: I966f985e1b9644bdf8ae81d9abb142d80320cc82
Gerrit-Change-Number: 708135
Gerrit-PatchSet: 2
Gerrit-Owner: Damien Neil <dn...@google.com>
Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
Gerrit-Reviewer: Brad Fitzpatrick <brad...@tailscale.com>
Gerrit-Reviewer: Damien Neil <dn...@google.com>
Gerrit-Reviewer: Nicholas Husin <n...@golang.org>
Gerrit-Attention: Brad Fitzpatrick <brad...@tailscale.com>
Gerrit-Attention: Nicholas Husin <n...@golang.org>
Gerrit-Comment-Date: Wed, 01 Oct 2025 16:12:00 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Brian Palmer (Gerrit)

unread,
12:22 PM (10 hours ago) 12:22 PM
to Damien Neil, goph...@pubsubhelper.golang.org, Nicholas Husin, Brad Fitzpatrick, Go LUCI, Brad Fitzpatrick, golang-co...@googlegroups.com
Attention needed from Brad Fitzpatrick, Damien Neil and Nicholas Husin

Brian Palmer added 1 comment

File http2/server.go
Line 221, Patchset 1: return make(chan error, 1) // Server used without calling ConfigureServer
Brad Fitzpatrick . resolved

maybe revert to the package global variable form like before in this case? otherwise if this is a valid way to use a Server, it could be a surprising performance difference

Brad Fitzpatrick

Or can we put a sync.Once on serverInternalState and add an errChanPool accessor method that does the lazy init, removing it from ConfigureServer?

Damien Neil

Good thought on reverting to package global. Did that.

The `s == nil` case occurs when `Server.state` is uninitialized (nil). We'd need a way to lazily set `Server.state`, which is tricky: We could make it atomic (probably no real performance cost, since it'd be mostly uncontended?), or we could make an unsynchronized initialization in `Server.serveConn` (probably fine, but could cause race conditions for some people).

I'd rather not figure any of that out right now.

Brian Palmer

Falling back to the global pool does mean that when `Server.state` is uninitialized, tests will sporadically see the same failures that we are seeing in golang/go#75674 right? I'm not clear on how common that state is.

Open in Gerrit

Related details

Attention is currently required from:
  • Brad Fitzpatrick
  • Damien Neil
  • Nicholas Husin
Submit Requirements:
  • requirement satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: net
Gerrit-Branch: master
Gerrit-Change-Id: I966f985e1b9644bdf8ae81d9abb142d80320cc82
Gerrit-Change-Number: 708135
Gerrit-PatchSet: 2
Gerrit-Owner: Damien Neil <dn...@google.com>
Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
Gerrit-Reviewer: Brad Fitzpatrick <brad...@tailscale.com>
Gerrit-Reviewer: Damien Neil <dn...@google.com>
Gerrit-Reviewer: Nicholas Husin <n...@golang.org>
Gerrit-CC: Brian Palmer <bri...@tailscale.com>
Gerrit-Attention: Brad Fitzpatrick <brad...@tailscale.com>
Gerrit-Attention: Damien Neil <dn...@google.com>
Gerrit-Attention: Nicholas Husin <n...@golang.org>
Gerrit-Comment-Date: Wed, 01 Oct 2025 16:22:13 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Damien Neil <dn...@google.com>
Comment-In-Reply-To: Brad Fitzpatrick <brad...@golang.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Damien Neil (Gerrit)

unread,
12:30 PM (10 hours ago) 12:30 PM
to goph...@pubsubhelper.golang.org, Brian Palmer, Nicholas Husin, Brad Fitzpatrick, Go LUCI, Brad Fitzpatrick, golang-co...@googlegroups.com
Attention needed from Brad Fitzpatrick, Brian Palmer and Nicholas Husin

Damien Neil added 1 comment

File http2/server.go
Line 221, Patchset 1: return make(chan error, 1) // Server used without calling ConfigureServer
Brad Fitzpatrick . resolved

maybe revert to the package global variable form like before in this case? otherwise if this is a valid way to use a Server, it could be a surprising performance difference

Brad Fitzpatrick

Or can we put a sync.Once on serverInternalState and add an errChanPool accessor method that does the lazy init, removing it from ConfigureServer?

Damien Neil

Good thought on reverting to package global. Did that.

The `s == nil` case occurs when `Server.state` is uninitialized (nil). We'd need a way to lazily set `Server.state`, which is tricky: We could make it atomic (probably no real performance cost, since it'd be mostly uncontended?), or we could make an unsynchronized initialization in `Server.serveConn` (probably fine, but could cause race conditions for some people).

I'd rather not figure any of that out right now.

Brian Palmer

Falling back to the global pool does mean that when `Server.state` is uninitialized, tests will sporadically see the same failures that we are seeing in golang/go#75674 right? I'm not clear on how common that state is.

Damien Neil

The global pool fallback should (I think) happen only for programs serving connections directly with `http2.Server.ServeConn`. I don't think that's very common. The much more common case of using `http.Server.ListenAndServeTLS` (or similar) will initialize the HTTP/2 server state and use a per-server pool.

Open in Gerrit

Related details

Attention is currently required from:
  • Brad Fitzpatrick
  • Brian Palmer
  • Nicholas Husin
Submit Requirements:
  • requirement satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: net
Gerrit-Branch: master
Gerrit-Change-Id: I966f985e1b9644bdf8ae81d9abb142d80320cc82
Gerrit-Change-Number: 708135
Gerrit-PatchSet: 2
Gerrit-Owner: Damien Neil <dn...@google.com>
Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
Gerrit-Reviewer: Brad Fitzpatrick <brad...@tailscale.com>
Gerrit-Reviewer: Damien Neil <dn...@google.com>
Gerrit-Reviewer: Nicholas Husin <n...@golang.org>
Gerrit-CC: Brian Palmer <bri...@tailscale.com>
Gerrit-Attention: Brian Palmer <bri...@tailscale.com>
Gerrit-Attention: Brad Fitzpatrick <brad...@tailscale.com>
Gerrit-Attention: Nicholas Husin <n...@golang.org>
Gerrit-Comment-Date: Wed, 01 Oct 2025 16:30:32 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Brian Palmer <bri...@tailscale.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Damien Neil (Gerrit)

unread,
12:38 PM (10 hours ago) 12:38 PM
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
Attention needed from Brad Fitzpatrick, Brian Palmer and Nicholas Husin

Damien Neil uploaded new patchset

Damien Neil uploaded patch set #3 to this change.
Following approvals got outdated and were removed:
  • TryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
Open in Gerrit

Related details

Attention is currently required from:
  • Brad Fitzpatrick
  • Brian Palmer
  • Nicholas Husin
Submit Requirements:
    • requirement satisfiedCode-Review
    • requirement satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: newpatchset
    Gerrit-Project: net
    Gerrit-Branch: master
    Gerrit-Change-Id: I966f985e1b9644bdf8ae81d9abb142d80320cc82
    Gerrit-Change-Number: 708135
    Gerrit-PatchSet: 3
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Nicholas Husin (Gerrit)

    unread,
    12:42 PM (10 hours ago) 12:42 PM
    to Damien Neil, goph...@pubsubhelper.golang.org, Brian Palmer, Brad Fitzpatrick, Go LUCI, Brad Fitzpatrick, golang-co...@googlegroups.com
    Attention needed from Brad Fitzpatrick and Brian Palmer

    Nicholas Husin voted

    Auto-Submit+1
    Code-Review+2
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Brad Fitzpatrick
    • Brian Palmer
    Submit Requirements:
    • requirement satisfiedCode-Review
    • requirement satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: net
    Gerrit-Branch: master
    Gerrit-Change-Id: I966f985e1b9644bdf8ae81d9abb142d80320cc82
    Gerrit-Change-Number: 708135
    Gerrit-PatchSet: 3
    Gerrit-Owner: Damien Neil <dn...@google.com>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
    Gerrit-Reviewer: Brad Fitzpatrick <brad...@tailscale.com>
    Gerrit-Reviewer: Damien Neil <dn...@google.com>
    Gerrit-Reviewer: Nicholas Husin <n...@golang.org>
    Gerrit-CC: Brian Palmer <bri...@tailscale.com>
    Gerrit-Attention: Brian Palmer <bri...@tailscale.com>
    Gerrit-Attention: Brad Fitzpatrick <brad...@tailscale.com>
    Gerrit-Comment-Date: Wed, 01 Oct 2025 16:42:52 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Nicholas Husin (Gerrit)

    unread,
    12:43 PM (10 hours ago) 12:43 PM
    to Damien Neil, goph...@pubsubhelper.golang.org, Nicholas Husin, Brian Palmer, Brad Fitzpatrick, Go LUCI, Brad Fitzpatrick, golang-co...@googlegroups.com
    Attention needed from Brad Fitzpatrick, Brian Palmer and Damien Neil

    Nicholas Husin voted Code-Review+1

    Code-Review+1
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Brad Fitzpatrick
    • Brian Palmer
    • Damien Neil
    Submit Requirements:
      • requirement satisfiedCode-Review
      • requirement satisfiedNo-Unresolved-Comments
      • requirement satisfiedReview-Enforcement
      • requirement is not satisfiedTryBots-Pass
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: net
      Gerrit-Branch: master
      Gerrit-Change-Id: I966f985e1b9644bdf8ae81d9abb142d80320cc82
      Gerrit-Change-Number: 708135
      Gerrit-PatchSet: 3
      Gerrit-Owner: Damien Neil <dn...@google.com>
      Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
      Gerrit-Reviewer: Brad Fitzpatrick <brad...@tailscale.com>
      Gerrit-Reviewer: Damien Neil <dn...@google.com>
      Gerrit-Reviewer: Nicholas Husin <hu...@google.com>
      Gerrit-Reviewer: Nicholas Husin <n...@golang.org>
      Gerrit-CC: Brian Palmer <bri...@tailscale.com>
      Gerrit-Attention: Brian Palmer <bri...@tailscale.com>
      Gerrit-Attention: Brad Fitzpatrick <brad...@tailscale.com>
      Gerrit-Attention: Damien Neil <dn...@google.com>
      Gerrit-Comment-Date: Wed, 01 Oct 2025 16:43:01 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Gopher Robot (Gerrit)

      unread,
      12:50 PM (10 hours ago) 12:50 PM
      to Damien Neil, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Go LUCI, Nicholas Husin, Nicholas Husin, Brian Palmer, Brad Fitzpatrick, Brad Fitzpatrick, golang-co...@googlegroups.com

      Gopher Robot submitted the change

      Change information

      Commit message:
      http2: make the error channel pool per-Server

      Channels can't be shared across synctest bubbles, so a global pool causes
      panics when using an http2.Server in a bubble. Make the pool per-Server.
      A Server can't be shared across bubbles anyway (it contains channels)
      and outside of tests most programs will have a single Server.

      Fixes golang/go#75674
      Change-Id: I966f985e1b9644bdf8ae81d9abb142d80320cc82
      Auto-Submit: Nicholas Husin <n...@golang.org>
      Reviewed-by: Brad Fitzpatrick <brad...@golang.org>
      Reviewed-by: Nicholas Husin <hu...@google.com>
      Reviewed-by: Nicholas Husin <n...@golang.org>
      Files:
      • M http2/http2.go
      • M http2/http2_test.go
      • M http2/server.go
      Change size: M
      Delta: 3 files changed, 35 insertions(+), 28 deletions(-)
      Branch: refs/heads/master
      Submit Requirements:
      • requirement satisfiedCode-Review: +2 by Nicholas Husin, +2 by Brad Fitzpatrick, +1 by Nicholas Husin
      • requirement satisfiedTryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
      Open in Gerrit
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: merged
      Gerrit-Project: net
      Gerrit-Branch: master
      Gerrit-Change-Id: I966f985e1b9644bdf8ae81d9abb142d80320cc82
      Gerrit-Change-Number: 708135
      Gerrit-PatchSet: 4
      Gerrit-Owner: Damien Neil <dn...@google.com>
      Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
      Gerrit-Reviewer: Brad Fitzpatrick <brad...@tailscale.com>
      Gerrit-Reviewer: Damien Neil <dn...@google.com>
      Gerrit-Reviewer: Gopher Robot <go...@golang.org>
      open
      diffy
      satisfied_requirement
      Reply all
      Reply to author
      Forward
      0 new messages