zrepl/rpc/dataconn/frameconn
Mathias Fredriksson 4539ccf79b 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-30 21:35:29 +01:00
..
frameconn_prometheus.go rpc rewrite: control RPCs using gRPC + separate RPC for data transfer 2019-03-13 13:53:48 +01:00
frameconn_shutdown_fsm.go run golangci-lint and apply suggested fixes 2019-03-27 13:12:26 +01:00
frameconn_test.go format source tree using goimports 2019-03-22 19:41:12 +01:00
frameconn.go rpc: fix data race in timeoutconn 2021-01-30 21:35:29 +01:00