1. 03 Oct, 2018 29 commits
  2. 02 Oct, 2018 11 commits
    • Brad Fitzpatrick's avatar
      net/http: make Transport send WebSocket upgrade requests over HTTP/1 · a73d8f5a
      Brad Fitzpatrick authored
      WebSockets requires HTTP/1 in practice (no spec or implementations
      work over HTTP/2), so if we get an HTTP request that looks like it's
      trying to initiate WebSockets, use HTTP/1, like browsers do.
      
      This is part of a series of commits to make WebSockets work over
      httputil.ReverseProxy. See #26937.
      
      Updates #26937
      
      Change-Id: I6ad3df9b0a21fddf62fa7d9cacef48e7d5d9585b
      Reviewed-on: https://go-review.googlesource.com/c/137437
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarDmitri Shuralyov <dmitshur@golang.org>
      a73d8f5a
    • Aleksandr Razumov's avatar
      net/http: rewind request body unconditionally · 3aa3c052
      Aleksandr Razumov authored
      When http2 fails with ErrNoCachedConn the request is retried with body
      that has already been read.
      
      Fixes #25009
      
      Change-Id: I51ed5c8cf469dd8b17c73fff6140ab80162bf267
      Reviewed-on: https://go-review.googlesource.com/c/131755
      Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      3aa3c052
    • Austin Clements's avatar
      runtime: eliminate gchelper mechanism · 0906d648
      Austin Clements authored
      Now that we do no mark work during mark termination, we no longer need
      the gchelper mechanism.
      
      Updates #26903.
      Updates #17503.
      
      Change-Id: Ie94e5c0f918cfa047e88cae1028fece106955c1b
      Reviewed-on: https://go-review.googlesource.com/c/134785
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRick Hudson <rlh@golang.org>
      0906d648
    • Austin Clements's avatar
      runtime: eliminate work.markrootdone and second root marking pass · 550dfc8a
      Austin Clements authored
      Before STW and concurrent GC were unified, there could be either one
      or two root marking passes per GC cycle. There were several tasks we
      had to make sure happened once and only once (whether that was at the
      beginning of concurrent mark for concurrent GC or during mark
      termination for STW GC). We kept track of this in work.markrootdone.
      
      Now that STW and concurrent GC both use the concurrent marking code
      and we've eliminated all work done by the second root marking pass, we
      only ever need a single root marking pass. Hence, we can eliminate
      work.markrootdone and all of the code that's conditional on it.
      
      Updates #26903.
      
      Change-Id: I654a0f5e21b9322279525560a31e64b8d33b790f
      Reviewed-on: https://go-review.googlesource.com/c/134784
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRick Hudson <rlh@golang.org>
      550dfc8a
    • Austin Clements's avatar
      runtime: flush mcaches lazily · 873bd47d
      Austin Clements authored
      Currently, all mcaches are flushed during STW mark termination as a
      root marking job. This is currently necessary because all spans must
      be out of these caches before sweeping begins to avoid races with
      allocation and to ensure the spans are in the state expected by
      sweeping. We do it as a root marking job because mcache flushing is
      somewhat expensive and O(GOMAXPROCS) and this parallelizes the work
      across the Ps. However, it's also the last remaining root marking job
      performed during mark termination.
      
      This CL moves mcache flushing out of mark termination and performs it
      lazily. We keep track of the last sweepgen at which each mcache was
      flushed and as each P is woken from STW, it observes that its mcache
      is out-of-date and flushes it.
      
      The introduces a complication for spans cached in stale mcaches. These
      may now be observed by background or proportional sweeping or when
      attempting to add a finalizer, but aren't in a stable state. For
      example, they are likely to be on the wrong mcentral list. To fix
      this, this CL extends the sweepgen protocol to also capture whether a
      span is cached and, if so, whether or not its cache is stale. This
      protocol blocks asynchronous sweeping from touching cached spans and
      makes it the responsibility of mcache flushing to sweep the flushed
      spans.
      
      This eliminates the last mark termination root marking job, which
      means we can now eliminate that entire infrastructure.
      
      Updates #26903. This implements lazy mcache flushing.
      
      Change-Id: Iadda7aabe540b2026cffc5195da7be37d5b4125e
      Reviewed-on: https://go-review.googlesource.com/c/134783
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRick Hudson <rlh@golang.org>
      873bd47d
    • Austin Clements's avatar
      runtime: eliminate blocking GC work drains · 457c8f4f
      Austin Clements authored
      Now work.helperDrainBlock is always false, so we can remove it and
      code paths that only ran when it was true. That means we no longer use
      the gcDrainBlock mode of gcDrain, so we can eliminate that. That means
      we no longer use gcWork.get, so we can eliminate that. That means we
      no longer use getfull, so we can eliminate that.
      
      Updates #26903. This is a follow-up to unifying STW GC and concurrent GC.
      
      Change-Id: I8dbcf8ce24861df0a6149e0b7c5cd0eadb5c13f6
      Reviewed-on: https://go-review.googlesource.com/c/134782
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRick Hudson <rlh@golang.org>
      457c8f4f
    • Austin Clements's avatar
      runtime: clean up remaining mark work check · 143b13ae
      Austin Clements authored
      Now that STW GC marking is unified with concurrent marking, there
      should never be mark work remaining in mark termination. Hence, we can
      make that check unconditional.
      
      Updates #26903. This is a follow-up to unifying STW GC and concurrent GC.
      
      Change-Id: I43a21df5577635ab379c397a7405ada68d331e03
      Reviewed-on: https://go-review.googlesource.com/c/134781
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRick Hudson <rlh@golang.org>
      143b13ae
    • Austin Clements's avatar
      runtime: implement STW GC in terms of concurrent GC · 1678b2c5
      Austin Clements authored
      Currently, STW GC works very differently from concurrent GC. The
      largest differences in that in concurrent GC, all marking work is done
      by background mark workers during the mark phase, while in STW GC, all
      marking work is done by gchelper during the mark termination phase.
      
      This is a consequence of the evolution of Go's GC from a STW GC by
      incrementally moving work from STW mark termination into concurrent
      mark. However, at this point, the STW code paths exist only as a
      debugging mode. Having separate code paths for this increases the
      maintenance burden and complexity of the garbage collector. At the
      same time, these code paths aren't tested nearly as well, making it
      far more likely that they will bit-rot.
      
      This CL reverses the relationship between STW GC, by re-implementing
      STW GC in terms of concurrent GC.
      
      This builds on the new scheduled support for disabling user goroutine
      scheduling. During sweep termination, it disables user scheduling, so
      when the GC starts the world again for concurrent mark, it's really
      only "concurrent" with itself.
      
      There are several code paths that were specific to STW GC that are now
      vestigial. We'll remove these in the follow-up CLs.
      
      Updates #26903.
      
      Change-Id: Ia3883d2fcf7ab1d89bdc9c8ee54bf9bffb32c096
      Reviewed-on: https://go-review.googlesource.com/c/134780
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRick Hudson <rlh@golang.org>
      1678b2c5
    • Austin Clements's avatar
      runtime: support disabling goroutine scheduling by class · 6e9fb11b
      Austin Clements authored
      This adds support for disabling the scheduling of user goroutines
      while allowing system goroutines like the garbage collector to
      continue running. User goroutines pass through the usual state
      transitions, but if we attempt to actually schedule one, it will get
      put on a deferred scheduling list.
      
      Updates #26903. This is preparation for unifying STW GC and concurrent
      GC.
      
      Updates #25578. This same mechanism can form the basis for disabling
      all but a single user goroutine for the purposes of debugger function
      call injection.
      
      Change-Id: Ib72a808e00c25613fe6982f5528160d3de3dbbc6
      Reviewed-on: https://go-review.googlesource.com/c/134779
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRick Hudson <rlh@golang.org>
      6e9fb11b
    • Austin Clements's avatar
      runtime: add a more stable isSystemGoroutine mode · 29b21ec4
      Austin Clements authored
      Currently, isSystemGoroutine varies on whether it considers the
      finalizer goroutine a user goroutine or a system goroutine. For the
      next CL, we're going to want to always consider the finalier goroutine
      a user goroutine, so add a flag that indicates that.
      
      Updates #26903. This is preparation for unifying STW GC and concurrent
      GC.
      
      Change-Id: Iafc92e519c13d9f8d879332cb5f0d12164104c33
      Reviewed-on: https://go-review.googlesource.com/c/134778
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRick Hudson <rlh@golang.org>
      29b21ec4
    • Austin Clements's avatar
      runtime: remove GODEBUG=gcrescanstacks=1 mode · 198440cc
      Austin Clements authored
      Currently, setting GODEBUG=gcrescanstacks=1 enables a debugging mode
      where the garbage collector re-scans goroutine stacks during mark
      termination. This was introduced in Go 1.8 to debug the hybrid write
      barrier, but I don't think we ever used it.
      
      Now it's one of the last sources of mark work during mark termination.
      This CL removes it.
      
      Updates #26903. This is preparation for unifying STW GC and concurrent
      GC.
      
      Updates #17503.
      
      Change-Id: I6ae04d3738aa9c448e6e206e21857a33ecd12acf
      Reviewed-on: https://go-review.googlesource.com/c/134777
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRick Hudson <rlh@golang.org>
      198440cc