Commit 52ee700
committed
ctp: make channels unbounded
This commit makes the channels used by the CTP implementation to connect
the send and recv tasks with the `Connection` into unbounded channels.
It was nice to have them bounded for backpressure, but unfortunately
this leads to a deadlock on the server side. Specifically, if the
connection is configured without a timeout and the send task isn't able
to send messages for whatever reason, its channel can fill up. This in
turn can indefinitely block the server's connection task. Reconnecting
doesn't help in this case, as canceling the connection task requires
that task's cooperation (for cancel safety reasons).
Having unbounded channels introduces an opportunity for unbounded memory
growth, but that seems to be the least of all evils. We use unbounded in
a bunch of places already and so far we've not had many issues because
of that, which is reassuring.
The obvious alternative would be to always configure a send timeout.
This is tricky because of self-managed though: We can't rely on users
always choosing reasonable timeouts and cluster connection issues are
notoriously hard to debug, so we want to make cluster connections as
foolproof as possible. We could set a maximum timeout of say, one
minute, but even then a misconfigured timeout would cause cluster
reconnects to take very long, degrading UX for non-obvious reasons.1 parent ec83a28 commit 52ee700
1 file changed
+8
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
243 | 243 | | |
244 | 244 | | |
245 | 245 | | |
246 | | - | |
| 246 | + | |
247 | 247 | | |
248 | | - | |
| 248 | + | |
249 | 249 | | |
250 | 250 | | |
251 | 251 | | |
| |||
289 | 289 | | |
290 | 290 | | |
291 | 291 | | |
292 | | - | |
293 | | - | |
| 292 | + | |
| 293 | + | |
294 | 294 | | |
295 | 295 | | |
296 | 296 | | |
| |||
314 | 314 | | |
315 | 315 | | |
316 | 316 | | |
317 | | - | |
| 317 | + | |
318 | 318 | | |
319 | 319 | | |
320 | 320 | | |
| |||
347 | 347 | | |
348 | 348 | | |
349 | 349 | | |
350 | | - | |
| 350 | + | |
351 | 351 | | |
352 | 352 | | |
353 | 353 | | |
| |||
383 | 383 | | |
384 | 384 | | |
385 | 385 | | |
386 | | - | |
| 386 | + | |
387 | 387 | | |
388 | 388 | | |
389 | 389 | | |
| |||
393 | 393 | | |
394 | 394 | | |
395 | 395 | | |
396 | | - | |
| 396 | + | |
397 | 397 | | |
398 | 398 | | |
399 | 399 | | |
| |||
0 commit comments