| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Move diskspace mountpoint dictionary and pattern initialization out of the collection fast path and run it before starting the slow worker thread. The slow worker can run cleanup independently, so publishing the shared mountpoint dictionary lazily allowed it to observe partially initialized state and crash while reading mountpoint metadata.
There was a problem hiding this comment.
No issues found across 1 file
Confidence score: 5/5
sequenceDiagram
participant Main as diskspace_main (Main Thread)
participant Config as netdata_config
participant State as Shared State (dict_mountpoints)
participant Worker as slow_worker (Thread)
participant FastPath as do_disk_space_stats (Collection)
Note over Main, State: Initialization Phase
Main->>Main: NEW: diskspace_mountpoints_init()
Main->>Config: Get exclusion patterns/mountpoint settings
Config-->>Main: Config values
Main->>State: NEW: Initialize dictionary & patterns
Note over Main, Worker: Thread Lifecycle
Main->>Worker: spawn_pthread(slow_worker_main)
loop Every update_every seconds
Main->>FastPath: Run collection cycle
FastPath->>State: CHANGED: Safely access initialized dictionary
FastPath-->>Main: Update charts
opt In Background
Worker->>State: Access mountpoints for cleanup/slow ops
Note right of Worker: Race condition avoided: State is guaranteed init
end
end
Note over Main, State: Cleanup Phase
Main->>State: NEW: Free exclusion patterns & destroy dictionary
Sorry, something went wrong.
There was a problem hiding this comment.
Fixes a startup race in the diskspace collector by ensuring shared mountpoint state is initialized before the slow worker thread can observe it, avoiding crashes from partially initialized metadata.
Changes:
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Sorry, something went wrong.
|
Sorry, something went wrong.
There was a problem hiding this comment.
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Sorry, something went wrong.
There was a problem hiding this comment.
Disk space is working as expected. LGTM!
Sorry, something went wrong.
* fix(diskspace): initialize mountpoint state before slow worker Move diskspace mountpoint dictionary and pattern initialization out of the collection fast path and run it before starting the slow worker thread. The slow worker can run cleanup independently, so publishing the shared mountpoint dictionary lazily allowed it to observe partially initialized state and crash while reading mountpoint metadata. * fix(diskspace): initialize shared state before function endpoint publishing (cherry picked from commit f568812)
| Back | FazBrowse Home | New Git URL |
Summary
Move diskspace mountpoint dictionary and pattern initialization out of the collection fast path and run it before starting the slow worker thread.
The slow worker can run cleanup independently, so publishing the shared mountpoint dictionary lazily allowed it to observe partially initialized state and crash while reading mountpoint metadata.
Summary by cubic
Initialize the diskspace mountpoint dictionary, exclusion patterns, and slow_mountinfo_mutex before publishing the function endpoint and starting the slow worker to prevent races on partially initialized state. Moves initialization out of the collection fast path.
Written for commit 31a0f37. Summary will update on new commits. Review in cubic