Repository navigation
fix(runtime): poll config file as safety net for dropped fsnotify events - #1637
Merged
Merged
Conversation
…vents fsnotify's kqueue backend (macOS) can drop the event for a config rename-over that lands right after a previous one. Instrumented stress runs showed the external revert to byte-identical self-written bytes produced no watcher event at all, so the running config stayed stale (TestConfigWatcher_ExternalRevertToLastSelfWriteReloads flaked on macOS-15 CI in #1629 and #1634). The watch loop now also compares the file bytes with the last evaluated content every 2s and, when they differ, runs the normal debounce -> reloadFromDiskIfChanged path (self-write suppression unchanged).
Deploying mcpproxy-docs with
|
| Latest commit: |
3324ea7
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://1f304a3a.mcpproxy-docs.pages.dev |
| Branch Preview URL: | https://fix-config-watcher-revert-fl.mcpproxy-docs.pages.dev |
Contributor
📦 Build ArtifactsWorkflow Run: View Run Available Artifacts
How to DownloadOption 1: GitHub Web UI (easiest)
Option 2: GitHub CLI gh run download 38917489320 --repo smart-mcp-proxy/mcpproxy-go
|
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root cause
TestConfigWatcher_ExternalRevertToLastSelfWriteReloadsflaked on macOS-15 runners (#1629, #1634). It is not a self-write-marker bug: with debug instrumentation under CPU load (reproduced ~1 in 100-250 runs locally on macOS), the final external revert to byte-identical A produced no fsnotify event at all after B's reload, so no debounce fired and the config stayed on B. fsnotify's kqueue backend can drop the event for a rename-over that follows a recently handled one. This is a real production hole (an external edit can be silently missed until restart), not only a test timing issue.Fix
runConfigWatchLoopnow also polls (2s) and compares file bytes with the last evaluated content; on a difference it arms the normal debounce ->reloadFromDiskIfChangedpath, so self-write suppression is unchanged. The poll does not re-arm a pending debounce.Tests
TestConfigWatcher_PollRecoversMissedFsEventdeterministically simulates total event loss (watch on an unrelated dir) and fails without the poll.TestConfigWatcher_suite under the same load, plus 20 clean sequential-raceruns.--build-tags server) oninternal/runtime: only a pre-existingreflect.Ptrinline finding inevent_bus.go, untouched here.