- Notifications
You must be signed in to change notification settings - Fork914
Commitb359fb9
fix: fix goroutine leak in log streaming over websocket (#15709)
fixes#14881Our handlers for streaming logs don't read from the websocket. We don't allow the client to send us any data, but the websocket library we use requires reading from the websocket to properly handle pings and closing. Not doing so can [can cause the websocket to hang on write](coder/websocket#405), leaking go routines which were noticed in#14881.This fixes the issue, and in process refactors our log streaming to a encoder/decoder package which provides generic types for sending JSON over websocket.I'd also like for us to upgrade to the latesthttps://github.com/coder/websocket but we should also upgrade our tailscale fork before doing so to avoid including two copies of the websocket library.(cherry picked from commit148a5a3)1 parent54f7605 commitb359fb9
File tree
6 files changed
+134
-78
lines changed- coderd
- codersdk
- wsjson
6 files changed
+134
-78
lines changedLines changed: 4 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
15 | 15 |
| |
16 | 16 |
| |
17 | 17 |
| |
| 18 | + | |
18 | 19 |
| |
19 | 20 |
| |
20 | 21 |
| |
| |||
312 | 313 |
| |
313 | 314 |
| |
314 | 315 |
| |
| 316 | + | |
315 | 317 |
| |
316 | 318 |
| |
317 | 319 |
| |
| |||
391 | 393 |
| |
392 | 394 |
| |
393 | 395 |
| |
| 396 | + | |
394 | 397 |
| |
395 | 398 |
| |
396 | 399 |
| |
| |||
488 | 491 |
| |
489 | 492 |
| |
490 | 493 |
| |
491 |
| - | |
492 |
| - | |
493 |
| - | |
494 |
| - | |
495 |
| - | |
| 494 | + | |
496 | 495 |
| |
497 | 496 |
| |
498 | 497 |
| |
|
Lines changed: 7 additions & 17 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
39 | 39 |
| |
40 | 40 |
| |
41 | 41 |
| |
| 42 | + | |
42 | 43 |
| |
43 | 44 |
| |
44 | 45 |
| |
| |||
396 | 397 |
| |
397 | 398 |
| |
398 | 399 |
| |
399 |
| - | |
400 |
| - | |
| 400 | + | |
| 401 | + | |
401 | 402 |
| |
402 |
| - | |
403 |
| - | |
404 | 403 |
| |
405 | 404 |
| |
406 | 405 |
| |
| |||
740 | 739 |
| |
741 | 740 |
| |
742 | 741 |
| |
743 |
| - | |
744 |
| - | |
745 |
| - | |
746 |
| - | |
747 |
| - | |
748 |
| - | |
749 |
| - | |
750 |
| - | |
751 |
| - | |
752 |
| - | |
| 742 | + | |
| 743 | + | |
753 | 744 |
| |
754 | 745 |
| |
755 | 746 |
| |
| |||
767 | 758 |
| |
768 | 759 |
| |
769 | 760 |
| |
770 |
| - | |
| 761 | + | |
771 | 762 |
| |
772 | 763 |
| |
773 | 764 |
| |
| |||
780 | 771 |
| |
781 | 772 |
| |
782 | 773 |
| |
783 |
| - | |
| 774 | + | |
784 | 775 |
| |
785 |
| - | |
786 | 776 |
| |
787 | 777 |
| |
788 | 778 |
| |
|
Lines changed: 3 additions & 30 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
19 | 19 |
| |
20 | 20 |
| |
21 | 21 |
| |
| 22 | + | |
22 | 23 |
| |
23 | 24 |
| |
24 | 25 |
| |
| |||
161 | 162 |
| |
162 | 163 |
| |
163 | 164 |
| |
164 |
| - | |
165 |
| - | |
166 |
| - | |
167 |
| - | |
168 |
| - | |
169 |
| - | |
170 |
| - | |
171 |
| - | |
172 |
| - | |
173 |
| - | |
174 |
| - | |
175 |
| - | |
176 |
| - | |
177 |
| - | |
178 |
| - | |
179 |
| - | |
180 |
| - | |
181 |
| - | |
182 |
| - | |
183 |
| - | |
184 |
| - | |
185 |
| - | |
186 |
| - | |
187 |
| - | |
188 |
| - | |
189 |
| - | |
190 |
| - | |
191 |
| - | |
192 |
| - | |
193 |
| - | |
| 165 | + | |
| 166 | + | |
194 | 167 |
| |
195 | 168 |
| |
196 | 169 |
| |
|
Lines changed: 3 additions & 26 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
15 | 15 |
| |
16 | 16 |
| |
17 | 17 |
| |
| 18 | + | |
18 | 19 |
| |
19 | 20 |
| |
20 | 21 |
| |
| |||
454 | 455 |
| |
455 | 456 |
| |
456 | 457 |
| |
457 |
| - | |
458 |
| - | |
459 |
| - | |
460 |
| - | |
461 |
| - | |
462 |
| - | |
463 |
| - | |
464 |
| - | |
465 |
| - | |
466 |
| - | |
467 |
| - | |
468 |
| - | |
469 |
| - | |
470 |
| - | |
471 |
| - | |
472 |
| - | |
473 |
| - | |
474 |
| - | |
475 |
| - | |
476 |
| - | |
477 |
| - | |
478 |
| - | |
479 |
| - | |
480 |
| - | |
481 |
| - | |
482 |
| - | |
| 458 | + | |
| 459 | + | |
483 | 460 |
|
Lines changed: 75 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + |
Lines changed: 42 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + |
0 commit comments
Comments
(0)