Commit c6e8dbe
[SPARK-54247][PYTHON][FOLLOWUP] Ensure socket is not leaked and add regression tests
### What changes were proposed in this pull request?
* #53200 did not fix the socket leak issue properly. This PR fixed it by closing the socket as well
* In order to prevent such mistakes, regression tests are added
* `_local_iterator_from_socket` is leaking socket too, fixed in this PR as well.
### Why are the changes needed?
To avoid leaking socket (technically it's still closed at GC, it was explained in #53200).
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
A new regression test is added and I confirmed the test fails before fix and passes after.
### Was this patch authored or co-authored using generative AI tooling?
No
Closes #53203 from gaogaotiantian/really-fix-socket-leak.
Authored-by: Tian Gao <[email protected]>
Signed-off-by: Ruifeng Zheng <[email protected]>1 parent 7c0b392 commit c6e8dbe
2 files changed
+20
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
1044 | 1045 | | |
1045 | 1046 | | |
1046 | 1047 | | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
1047 | 1060 | | |
1048 | 1061 | | |
1049 | 1062 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
668 | 668 | | |
669 | 669 | | |
670 | 670 | | |
671 | | - | |
| 671 | + | |
672 | 672 | | |
673 | 673 | | |
674 | 674 | | |
| |||
689 | 689 | | |
690 | 690 | | |
691 | 691 | | |
692 | | - | |
| 692 | + | |
693 | 693 | | |
694 | 694 | | |
695 | 695 | | |
| |||
710 | 710 | | |
711 | 711 | | |
712 | 712 | | |
713 | | - | |
| 713 | + | |
714 | 714 | | |
715 | 715 | | |
716 | 716 | | |
| 717 | + | |
717 | 718 | | |
718 | 719 | | |
719 | 720 | | |
| |||
725 | 726 | | |
726 | 727 | | |
727 | 728 | | |
728 | | - | |
| 729 | + | |
729 | 730 | | |
730 | 731 | | |
731 | 732 | | |
| |||
761 | 762 | | |
762 | 763 | | |
763 | 764 | | |
| 765 | + | |
| 766 | + | |
764 | 767 | | |
765 | 768 | | |
766 | 769 | | |
| |||
0 commit comments