Dan Upton
73b9b407ba
grpc: fix data race in balancer registration ( #16229 )
...
Registering gRPC balancers is thread-unsafe because they are stored in a
global map variable that is accessed without holding a lock. Therefore,
it's expected that balancers are registered _once_ at the beginning of
your program (e.g. in a package `init` function) and certainly not after
you've started dialing connections, etc.
> NOTE: this function must only be called during initialization time
> (i.e. in an init() function), and is not thread-safe.
While this is fine for us in production, it's challenging for tests that
spin up multiple agents in-memory. We currently register a balancer per-
agent which holds agent-specific state that cannot safely be shared.
This commit introduces our own registry that _is_ thread-safe, and
implements the Builder interface such that we can call gRPC's `Register`
method once, on start-up. It uses the same pattern as our resolver
registry where we use the dial target's host (aka "authority"), which is
unique per-agent, to determine which builder to use.
2023-02-28 10:18:38 +00:00
..
2022-02-03 13:42:28 -05:00
2023-02-17 16:14:46 -05:00
2023-01-18 12:33:21 -06:00
2023-02-17 16:14:46 -05:00
2023-01-05 11:47:45 -06:00
2023-02-17 16:14:46 -05:00
2023-02-03 10:51:53 -05:00
2023-02-13 14:18:05 -05:00
2023-02-28 10:18:38 +00:00
2022-05-19 14:00:07 -05:00
2023-02-17 16:14:46 -05:00
2023-02-23 14:52:18 -05:00
2023-02-28 10:18:38 +00:00
2023-02-17 16:14:46 -05:00
2023-01-18 12:33:21 -06:00
2023-02-03 08:45:11 -06:00
2023-01-06 11:33:53 -07:00
2022-08-31 16:38:42 -05:00
2023-01-06 17:49:33 -06:00
2023-02-17 16:14:46 -05:00
2023-02-17 16:14:46 -05:00
2023-02-21 13:59:36 -06:00
2023-01-18 12:33:21 -06:00
2022-10-24 16:12:08 -04:00
2022-11-10 10:26:01 -06:00
2023-02-28 10:18:38 +00:00
2023-02-17 16:14:46 -05:00
2023-02-22 14:55:40 -05:00
2023-02-17 16:14:46 -05:00
2023-01-10 10:24:02 -06:00
2022-11-10 10:26:01 -06:00
2023-02-24 17:00:31 -05:00
2023-02-08 23:49:44 +00:00
2023-02-08 23:49:44 +00:00
2023-02-07 14:19:09 -06:00
2023-01-09 12:28:53 -06:00
2022-05-09 10:07:19 -07:00
2023-01-20 12:59:26 -05:00
2023-02-07 12:26:30 -06:00
2023-02-06 09:14:35 -08:00
2022-06-01 16:18:06 +01:00
2023-02-17 16:14:46 -05:00
2023-02-28 10:18:38 +00:00
2022-12-14 09:24:22 -06:00
2023-02-08 12:07:21 -08:00
2022-04-05 15:11:49 -07:00
2022-12-14 09:24:22 -06:00
2022-12-14 09:24:22 -06:00
2022-04-29 13:42:49 -04:00
2022-11-10 10:26:01 -06:00
2022-12-14 09:24:22 -06:00
2023-02-17 15:04:12 -05:00
2022-12-14 09:24:22 -06:00
2022-12-14 09:24:22 -06:00
2022-12-14 09:24:22 -06:00
2022-12-14 09:24:22 -06:00
2022-12-14 09:24:22 -06:00
2022-11-29 12:23:18 -06:00
2022-12-14 09:24:22 -06:00
2022-12-14 09:24:22 -06:00
2023-01-24 16:21:41 +00:00
2022-06-01 13:17:14 -04:00
2022-12-14 09:24:22 -06:00
2022-12-14 09:24:22 -06:00
2022-12-14 09:24:22 -06:00
2022-10-24 16:12:08 -04:00
2022-04-29 13:42:49 -04:00
2023-02-08 12:07:21 -08:00
2023-02-21 08:28:13 -05:00
2023-02-17 16:14:46 -05:00
2022-12-14 09:24:22 -06:00
2022-12-14 09:24:22 -06:00
2022-11-10 10:26:01 -06:00
2022-12-14 09:24:22 -06:00
2022-12-14 09:24:22 -06:00
2023-02-23 14:07:17 +00:00
2022-11-10 10:26:01 -06:00
2022-11-10 10:26:01 -06:00
2023-02-08 12:07:21 -08:00
2022-12-14 09:24:22 -06:00
2023-02-17 16:14:46 -05:00
2023-02-17 16:14:46 -05:00
2023-02-17 16:14:46 -05:00
2023-02-17 16:14:46 -05:00
2023-02-17 15:04:12 -05:00
2022-12-14 09:24:22 -06:00
2022-12-14 09:24:22 -06:00
2022-12-14 09:24:22 -06:00
2022-09-26 14:58:15 -04:00
2022-12-14 20:28:25 +00:00
2022-10-12 07:49:56 -07:00
2023-02-03 10:51:53 -05:00
2023-02-03 10:51:53 -05:00
2022-12-14 09:24:22 -06:00
2022-12-14 09:24:22 -06:00
2023-02-28 10:18:38 +00:00
2022-11-04 09:29:16 -05:00
2022-09-09 09:47:10 -05:00
2023-01-24 16:21:41 +00:00
2022-12-14 09:24:22 -06:00
2023-02-17 15:04:12 -05:00
2023-02-17 15:04:12 -05:00
2022-12-14 09:24:22 -06:00
2022-12-14 09:24:22 -06:00
2023-02-17 16:14:46 -05:00
2022-12-14 09:24:22 -06:00
2023-01-10 10:24:02 -06:00
2022-12-14 09:24:22 -06:00
2022-11-10 10:26:01 -06:00