Commit 17b3ab2
committed
fix: resolve lost-wakeup races in InMemoryTaskStore.wait_for_update
Two races in wait_for_update:
1. Concurrent waiters: second caller overwrites the first's event in
_update_events[task_id], so the first waiter hangs forever.
Fix: use a list of events per task_id so each waiter gets its own.
2. Notify before wait: if update_task completes before wait_for_update
is called, the signal is lost because no event exists yet.
Fix: track pending updates in a set; wait_for_update checks and
consumes pending flags before creating an event.
Both races are reachable via task_result_handler.py:126 when multiple
clients poll the same task or when a task completes between status
checks.
Fixes #25351 parent 3d7b311 commit 17b3ab2
1 file changed
Lines changed: 29 additions & 7 deletions
File tree
Lines changed: 29 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
| 49 | + | |
| 50 | + | |
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
| |||
194 | 195 | | |
195 | 196 | | |
196 | 197 | | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
201 | 216 | | |
202 | 217 | | |
203 | 218 | | |
204 | | - | |
205 | | - | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
206 | 227 | | |
207 | 228 | | |
208 | 229 | | |
209 | 230 | | |
210 | 231 | | |
211 | 232 | | |
212 | 233 | | |
| 234 | + | |
213 | 235 | | |
214 | 236 | | |
215 | 237 | | |
| |||
0 commit comments