Commit 6cb5216
[SPARK-58932][4.2][SS] Close the accepted socket in TransformWithStateInPySparkStateServer
### What changes were proposed in this pull request?
Backport of #58205 to branch-4.2: run the request loop of `TransformWithStateInPySparkStateServer.run()` inside `Utils.tryWithResource` so the accepted socket is always closed. This branch does not have SPARK-58977, so unlike master the `accept()` call is unchanged.
### Why are the changes needed?
The accepted socket is never closed, leaking one file descriptor per task until the executor exhausts the ephemeral port range (`java.net.BindException`). See #58205 for details.
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
The two tests added in #58205 are included; `TransformWithStateInPySparkStateServerSuite` passes locally on this branch.
### Was this patch authored or co-authored using generative AI tooling?
Yes. Generated-by: Claude Opus 5
Closes #58308 from j1wonpark/SPARK-58932-4.2.
Authored-by: Jiwon Park <jpark92@outlook.kr>
Signed-off-by: Jungtaek Lim <kabhwan.opensource@gmail.com>1 parent 650761b commit 6cb5216
2 files changed
Lines changed: 40 additions & 2 deletions
File tree
- sql/core/src
- main/scala/org/apache/spark/sql/execution/python/streaming
- test/scala/org/apache/spark/sql/execution/python/streaming
Lines changed: 9 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
| |||
140 | 141 | | |
141 | 142 | | |
142 | 143 | | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
143 | 151 | | |
144 | 152 | | |
145 | 153 | | |
| |||
Lines changed: 31 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
| |||
110 | 112 | | |
111 | 113 | | |
112 | 114 | | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
113 | 143 | | |
114 | 144 | | |
115 | 145 | | |
| |||
0 commit comments