Commit 414a2e4
committed
Fix persist worker exiting without processing newly arrived data
When persistWorker finds no pending history, a race window exists between
reading pendingHistory as null and the cleanup modifyManagerState call.
If queuePersist runs in that window, it sets pendingHistory but
ensurePersistWorker sees the still-alive worker fiber and skips spawning
a new one. The worker then exits, leaving a completed fiber reference
that permanently blocks new workers from being created.
Fix: return a flag from the cleanup indicating whether new data arrived
in the interim, and continue the loop instead of returning when it did.1 parent ab561b4 commit 414a2e4
1 file changed
+10
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
837 | 837 | | |
838 | 838 | | |
839 | 839 | | |
840 | | - | |
| 840 | + | |
841 | 841 | | |
842 | | - | |
843 | | - | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
844 | 847 | | |
845 | 848 | | |
846 | 849 | | |
847 | | - | |
| 850 | + | |
848 | 851 | | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
849 | 855 | | |
850 | 856 | | |
851 | 857 | | |
| |||
0 commit comments