GeoLocation and IPFilter background refresh flags can race and remain stuck
Summary¶
GeoLocation and IPFilter background refresh start their worker threads before marking refresh as queued. A fast worker failure or completion can post back to the UI and clear the flag before the starter sets it, leaving refresh stuck as in progress.
This blocks Beta 0.7.3 because automatic protection and geolocation refresh should not silently wedge after a fast failure or shutdown edge case.
Evidence¶
GeoLocation:
srchybrid/GeoLocation.cpp:763starts the background thread.srchybrid/GeoLocation.cpp:772setsm_bBackgroundRefreshQueued = true.srchybrid/GeoLocation.cpp:1019posts completion.srchybrid/GeoLocation.cpp:780clears the flag.
IPFilter:
srchybrid/IPFilterUpdater.cpp:367starts the background thread.srchybrid/IPFilterUpdater.cpp:375setsm_bBackgroundRefreshQueued = true.srchybrid/IPFilterUpdater.cpp:421posts completion.srchybrid/IPFilterUpdater.cpp:382clears the flag.
Execution Plan¶
- Revalidate the refresh state machines for manual, automatic, failed, and shutdown paths.
- Set the queued/running flag before the worker can post completion, or add an operation token that lets stale completions be ignored safely.
- Make thread launch failure restore idle state and clean temporary files.
- Make failed completion posts during shutdown terminal and non-wedging.
- Apply the same pattern to both GeoLocation and IPFilter updater.
- Add tests/seams for immediate worker failure and completion-before-return.
Acceptance Criteria¶
- Immediate worker completion cannot leave refresh permanently queued.
- Manual retry after a failed refresh is possible.
- Automatic refresh does not start overlapping workers.
- Temporary files are cleaned on launch failure and worker failure.
Validation¶
- 2026-05-08: Done in app commit
e5c8f81. python -m emule_workspace validate --workspace-root .python -m emule_workspace build app --workspace-root . --config Release --platform x64 --variant main- Code validation: GeoLocation and IPFilter updater workers are created
suspended, the queued flag is set before the worker can run, temporary files
are cleaned and the flag is cleared on launch failure, and the worker context
is released before
ResumeThread().