zrepl/rpc/dataconn/timeoutconn
Mathias Fredriksson d118bcc717 rpc: fix data race in timeoutconn
- `timeoutconn` handles state, yet calls to Read/Write make a copy of
  that state (non-pointer receiver) so any outbound calls will not have
  the state updated

- Even without the copy issue, the renew methods can in edge cases set a
  new deadline _after_ DisableTimeouts have been called, consider the
  following racy behavior:
    1. `renewReadDeadline` is called, checks `renewDeadlinesDisabled`
       (not disabled)
    2. `DisableTimeouts` is called, sets `renewDeadlinesDisabled`
    3. `DisableTimeouts` invokes `c.SetDeadline`
    4. `renewReadDeadline` invokes `c.SetReadDeadline`

To fix the above, the `Conn` receiver was made to be a pointer
everywhere and access to renewDeadlinesDisabled is now guarded
by an RWMutex instead of using atomics.

closes #415
2021-01-25 00:16:01 +01:00
..
internal/wireevaluator run golangci-lint and apply suggested fixes 2019-03-27 13:12:26 +01:00
timeoutconn_readv_unsupported.go rpc: fix data race in timeoutconn 2021-01-25 00:16:01 +01:00
timeoutconn_test.go rpc/dataconn/timeoutconn: tests: relax deadline in timeout tests 2020-05-18 19:46:24 +02:00
timeoutconn.go rpc: fix data race in timeoutconn 2021-01-25 00:16:01 +01:00
timoutconn_readv.go rpc: fix data race in timeoutconn 2021-01-25 00:16:01 +01:00