Commit ba13cca
committed
fix(adk): fix ack channel leak in concurrent preempt during TurnLoop shutdown
When drainAll runs during TurnLoop cleanup, a concurrent Push caller
that has already called holdRunLoop but not yet requestPreempt can
add an ack channel to pendingAckList after drainAll clears it. This
orphaned ack is never closed, causing the Push caller to hang.
Add a `drained` flag to preemptSignal. drainAll sets it, and
requestPreempt checks it — if drained, the ack is closed immediately
instead of being appended to pendingAckList.
Also fix the test to stop the loop concurrently with wg.Wait, since
the run loop may be blocked on buffer.Receive after processing all
preempts, and Stop is needed to unblock it and trigger drainAll.
Change-Id: I8d58b0e1478d2ae6f89e06d420b9252e43aa9cd61 parent eab218d commit ba13cca
2 files changed
Lines changed: 16 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
191 | 191 | | |
192 | 192 | | |
193 | 193 | | |
| 194 | + | |
194 | 195 | | |
195 | 196 | | |
196 | 197 | | |
| |||
223 | 224 | | |
224 | 225 | | |
225 | 226 | | |
226 | | - | |
| 227 | + | |
| 228 | + | |
227 | 229 | | |
228 | 230 | | |
229 | 231 | | |
230 | 232 | | |
231 | | - | |
| 233 | + | |
232 | 234 | | |
233 | 235 | | |
234 | 236 | | |
| |||
343 | 345 | | |
344 | 346 | | |
345 | 347 | | |
346 | | - | |
| 348 | + | |
| 349 | + | |
347 | 350 | | |
348 | 351 | | |
349 | 352 | | |
350 | 353 | | |
| 354 | + | |
351 | 355 | | |
352 | 356 | | |
353 | 357 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3122 | 3122 | | |
3123 | 3123 | | |
3124 | 3124 | | |
3125 | | - | |
| 3125 | + | |
3126 | 3126 | | |
3127 | 3127 | | |
3128 | 3128 | | |
3129 | 3129 | | |
3130 | 3130 | | |
3131 | 3131 | | |
3132 | | - | |
3133 | | - | |
| 3132 | + | |
| 3133 | + | |
| 3134 | + | |
| 3135 | + | |
| 3136 | + | |
| 3137 | + | |
| 3138 | + | |
3134 | 3139 | | |
3135 | | - | |
| 3140 | + | |
3136 | 3141 | | |
3137 | 3142 | | |
3138 | 3143 | | |
| |||
0 commit comments