• Augusto Roman's avatar
    Fix data race for max connection limiting in proxy directive. (#1438) · 463c9d9d
    Augusto Roman authored
    * Fix data race for max connection limiting in proxy directive.
    
    The Conns and Unhealthy fields are updated concurrently across all active
    requests.  Because of this, they must use atomic operations for reads and
    writes.
    
    Prior to this change, Conns was incremented atomically, but read unsafely.
    Unhealthly was updated & read unsafely.  The new test
    TestReverseProxyMaxConnLimit exposes this race when run with -race.
    
    Switching to atomic operations makes the race detector happy.
    
    * oops, remove leftover dead code.
    463c9d9d
upstream.go 9.63 KB