Commit f8c9e76
Roy Lin
fix(cri): close stdin / send port-forward CLOSE on streaming error paths
Three confirmed cleanup-on-error gaps from the CRI audit, hand-verified:
- handle_attach_stream: the stdin_once close-cleanup ran only on the clean loop
break; every error path (?/return Err on tcp read, stdin write, or tcp write)
returned early and skipped it, leaking an open stdin on an abnormal client
disconnect. Convert the error returns to break-with-stored-error so the
cleanup runs on every exit, then return the error.
- spdy serve_attach reader_task: the loop also breaks on a frame-read error/EOF
before a fin stdin frame, but only closed stdin on the fin path. Close stdin
after the loop too (stdin_once).
- handle_port_forward_stream tcp_to_guest: the CLOSE frame was sent only on a
clean client close (n==0); a read/write error left the guest's TCP connection
open waiting for data. Send CLOSE on every exit path (best-effort).
clippy -D warnings clean; 237 cri unit tests pass.1 parent a3e02d8 commit f8c9e76
2 files changed
Lines changed: 57 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
618 | 618 | | |
619 | 619 | | |
620 | 620 | | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
621 | 629 | | |
622 | 630 | | |
623 | 631 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
600 | 600 | | |
601 | 601 | | |
602 | 602 | | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
603 | 607 | | |
604 | 608 | | |
605 | 609 | | |
| |||
608 | 612 | | |
609 | 613 | | |
610 | 614 | | |
611 | | - | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
612 | 619 | | |
613 | 620 | | |
614 | 621 | | |
| |||
617 | 624 | | |
618 | 625 | | |
619 | 626 | | |
620 | | - | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
621 | 631 | | |
622 | 632 | | |
623 | | - | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
624 | 637 | | |
625 | 638 | | |
626 | 639 | | |
627 | 640 | | |
628 | 641 | | |
629 | 642 | | |
630 | | - | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
631 | 647 | | |
632 | 648 | | |
633 | | - | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
634 | 653 | | |
635 | 654 | | |
636 | 655 | | |
| |||
655 | 674 | | |
656 | 675 | | |
657 | 676 | | |
658 | | - | |
| 677 | + | |
659 | 678 | | |
660 | 679 | | |
661 | 680 | | |
| |||
732 | 751 | | |
733 | 752 | | |
734 | 753 | | |
735 | | - | |
736 | | - | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
737 | 759 | | |
738 | | - | |
739 | | - | |
740 | | - | |
741 | | - | |
742 | | - | |
743 | | - | |
744 | | - | |
745 | | - | |
| 760 | + | |
746 | 761 | | |
747 | | - | |
748 | | - | |
| 762 | + | |
749 | 763 | | |
750 | 764 | | |
751 | 765 | | |
752 | 766 | | |
753 | 767 | | |
754 | | - | |
755 | | - | |
756 | | - | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
757 | 785 | | |
758 | 786 | | |
759 | 787 | | |
| |||
0 commit comments