Commit e23223e
committed
Reject polls from recently-shutdown workers to prevent task theft
When ShutdownWorker cancels a worker's polls via CancelOutstandingWorkerPolls,
the SDK's graceful shutdown path may re-poll before fully stopping. This zombie
re-poll can sync-match with retry tasks (e.g., activity retries dispatched by
the timer queue), which the dying worker silently drops — causing the task to
sit until timeout.
Add a TTL cache of recently-shutdown WorkerInstanceKeys to the matching engine.
Polls arriving from workers in this cache are rejected immediately with an empty
response, preventing zombie re-polls from stealing tasks.
Made-with: Cursor1 parent 792f010 commit e23223e
3 files changed
Lines changed: 95 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
| |||
69 | 70 | | |
70 | 71 | | |
71 | 72 | | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
72 | 81 | | |
73 | 82 | | |
74 | 83 | | |
| |||
166 | 175 | | |
167 | 176 | | |
168 | 177 | | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
169 | 182 | | |
170 | 183 | | |
171 | 184 | | |
| |||
294 | 307 | | |
295 | 308 | | |
296 | 309 | | |
| 310 | + | |
297 | 311 | | |
298 | 312 | | |
299 | 313 | | |
| |||
1218 | 1232 | | |
1219 | 1233 | | |
1220 | 1234 | | |
| 1235 | + | |
| 1236 | + | |
| 1237 | + | |
1221 | 1238 | | |
1222 | 1239 | | |
1223 | 1240 | | |
| |||
2861 | 2878 | | |
2862 | 2879 | | |
2863 | 2880 | | |
| 2881 | + | |
| 2882 | + | |
| 2883 | + | |
2864 | 2884 | | |
2865 | 2885 | | |
2866 | 2886 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| |||
5690 | 5691 | | |
5691 | 5692 | | |
5692 | 5693 | | |
| 5694 | + | |
5693 | 5695 | | |
5694 | 5696 | | |
5695 | 5697 | | |
| |||
5705 | 5707 | | |
5706 | 5708 | | |
5707 | 5709 | | |
| 5710 | + | |
5708 | 5711 | | |
5709 | 5712 | | |
5710 | 5713 | | |
| |||
5731 | 5734 | | |
5732 | 5735 | | |
5733 | 5736 | | |
| 5737 | + | |
5734 | 5738 | | |
5735 | 5739 | | |
5736 | 5740 | | |
| |||
5753 | 5757 | | |
5754 | 5758 | | |
5755 | 5759 | | |
| 5760 | + | |
5756 | 5761 | | |
5757 | 5762 | | |
5758 | 5763 | | |
| |||
5775 | 5780 | | |
5776 | 5781 | | |
5777 | 5782 | | |
| 5783 | + | |
| 5784 | + | |
| 5785 | + | |
| 5786 | + | |
| 5787 | + | |
| 5788 | + | |
| 5789 | + | |
| 5790 | + | |
| 5791 | + | |
| 5792 | + | |
| 5793 | + | |
| 5794 | + | |
| 5795 | + | |
| 5796 | + | |
| 5797 | + | |
| 5798 | + | |
| 5799 | + | |
| 5800 | + | |
| 5801 | + | |
| 5802 | + | |
| 5803 | + | |
| 5804 | + | |
| 5805 | + | |
| 5806 | + | |
| 5807 | + | |
| 5808 | + | |
| 5809 | + | |
| 5810 | + | |
| 5811 | + | |
| 5812 | + | |
| 5813 | + | |
| 5814 | + | |
| 5815 | + | |
| 5816 | + | |
5778 | 5817 | | |
| 5818 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1500 | 1500 | | |
1501 | 1501 | | |
1502 | 1502 | | |
| 1503 | + | |
| 1504 | + | |
| 1505 | + | |
| 1506 | + | |
| 1507 | + | |
| 1508 | + | |
| 1509 | + | |
| 1510 | + | |
| 1511 | + | |
| 1512 | + | |
| 1513 | + | |
| 1514 | + | |
| 1515 | + | |
| 1516 | + | |
| 1517 | + | |
| 1518 | + | |
| 1519 | + | |
| 1520 | + | |
| 1521 | + | |
| 1522 | + | |
| 1523 | + | |
| 1524 | + | |
| 1525 | + | |
| 1526 | + | |
| 1527 | + | |
| 1528 | + | |
| 1529 | + | |
| 1530 | + | |
| 1531 | + | |
| 1532 | + | |
| 1533 | + | |
| 1534 | + | |
| 1535 | + | |
| 1536 | + | |
| 1537 | + | |
1503 | 1538 | | |
0 commit comments