aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/mpallocbits.go
diff options
context:
space:
mode:
authorAlexander Yastrebov <yastrebov.alex@gmail.com>2024-03-07 10:28:46 +0000
committerGopher Robot <gobot@golang.org>2024-03-08 01:59:51 +0000
commit8590f0aef30d1e4d242af97ae15266facb26493b (patch)
tree4b297968af81e89210313cc4d4e40e12aa995eb9 /src/runtime/mpallocbits.go
parentb57a544f99e5c4166468737942b7af5acb5936b3 (diff)
downloadgo-8590f0aef30d1e4d242af97ae15266facb26493b.tar.xz
net/http: remove persistConn reference from wantConn
Transport getConn creates wantConn w, tries to obtain idle connection for it based on the w.key and, when there is no idle connection, puts wantConn into idleConnWait wantConnQueue. Then getConn dials connection for w in a goroutine and blocks. After dial succeeds getConn unblocks and returns connection to the caller. At this point w is stored in the idleConnWait and will not be evicted until another wantConn with the same w.key is requested or alive connection returned into the idle pool which may not happen e.g. if server closes the connection. The problem is that even after tryDeliver succeeds w references persistConn wrapper that allocates bufio.Reader and bufio.Writer and prevents them from being garbage collected. To fix the problem this change removes persistConn and error references from wantConn and delivers them via channel to getConn. This way wantConn could be kept in wantConnQueues arbitrary long. Fixes #43966 Fixes #50798 Change-Id: I77942552f7db04c225fb40d770b3101a8cfe655d GitHub-Last-Rev: 027a0833f98b23ddadb3ec7ee4f2e62653bc7705 GitHub-Pull-Request: golang/go#62227 Reviewed-on: https://go-review.googlesource.com/c/go/+/522095 Reviewed-by: Damien Neil <dneil@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Auto-Submit: Damien Neil <dneil@google.com>
Diffstat (limited to 'src/runtime/mpallocbits.go')
0 files changed, 0 insertions, 0 deletions