Commit 89d2236
Address review feedback: fix Go deadlock, bounded channel, per-handler errors
Go SDK:
- Use channel-based event queue to avoid deadlocking the JSON-RPC
readLoop. Broadcast handlers (tool calls, permission requests) now
run on a dedicated consumer goroutine instead of inline on the
readLoop, preventing deadlock when they issue RPC requests.
- Close event channel on Disconnect for clean shutdown.
- Fix unit tests to use channel-based dispatch with goroutines,
properly validating serialization guarantees.
.NET SDK:
- Switch from unbounded to bounded channel (1024, Wait mode) to
prevent unbounded memory growth under high event throughput.
- Use GetInvocationList() for per-handler error catching so one
handler exception does not prevent remaining subscribers from
seeing the event.
- Add exception filters (when ex is not OperationCanceledException)
to avoid masking cooperative cancellation.
- Add dedicated test snapshot files for new tests so they don't
interfere with existing snapshot-based tests.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 9940278 commit 89d2236
6 files changed
Lines changed: 180 additions & 69 deletions
File tree
- dotnet
- src
- test
- go
- test/snapshots/session
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
| 75 | + | |
76 | 76 | | |
77 | 77 | | |
| 78 | + | |
| 79 | + | |
78 | 80 | | |
79 | | - | |
80 | | - | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
81 | 87 | | |
82 | 88 | | |
83 | 89 | | |
| |||
315 | 321 | | |
316 | 322 | | |
317 | 323 | | |
318 | | - | |
| 324 | + | |
319 | 325 | | |
320 | 326 | | |
321 | 327 | | |
322 | 328 | | |
323 | | - | |
324 | | - | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
325 | 333 | | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
331 | 345 | | |
332 | 346 | | |
333 | 347 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
470 | 470 | | |
471 | 471 | | |
472 | 472 | | |
473 | | - | |
474 | | - | |
475 | | - | |
476 | 473 | | |
477 | 474 | | |
478 | 475 | | |
| |||
500 | 497 | | |
501 | 498 | | |
502 | 499 | | |
503 | | - | |
504 | | - | |
505 | | - | |
506 | 500 | | |
507 | 501 | | |
508 | 502 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
15 | 17 | | |
16 | 18 | | |
17 | 19 | | |
| |||
65 | 67 | | |
66 | 68 | | |
67 | 69 | | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
68 | 76 | | |
69 | 77 | | |
70 | 78 | | |
| |||
78 | 86 | | |
79 | 87 | | |
80 | 88 | | |
81 | | - | |
| 89 | + | |
82 | 90 | | |
83 | 91 | | |
84 | 92 | | |
85 | 93 | | |
86 | 94 | | |
| 95 | + | |
87 | 96 | | |
88 | 97 | | |
| 98 | + | |
| 99 | + | |
89 | 100 | | |
90 | 101 | | |
91 | 102 | | |
| |||
435 | 446 | | |
436 | 447 | | |
437 | 448 | | |
438 | | - | |
| 449 | + | |
439 | 450 | | |
440 | | - | |
441 | | - | |
442 | | - | |
443 | | - | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
444 | 455 | | |
445 | | - | |
446 | | - | |
447 | | - | |
448 | | - | |
449 | | - | |
450 | | - | |
451 | | - | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
452 | 460 | | |
453 | | - | |
454 | | - | |
455 | | - | |
456 | | - | |
457 | | - | |
458 | | - | |
459 | | - | |
460 | | - | |
461 | | - | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
462 | 488 | | |
463 | | - | |
464 | | - | |
| 489 | + | |
465 | 490 | | |
466 | 491 | | |
467 | 492 | | |
468 | 493 | | |
469 | 494 | | |
470 | 495 | | |
471 | 496 | | |
472 | | - | |
473 | | - | |
| 497 | + | |
| 498 | + | |
474 | 499 | | |
475 | 500 | | |
476 | 501 | | |
| |||
641 | 666 | | |
642 | 667 | | |
643 | 668 | | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
644 | 673 | | |
645 | 674 | | |
646 | 675 | | |
| |||
0 commit comments