Prevent race condition during pluginsd array operations by stelfrag · Pull Request #21628 · netdata/netdata

cubic-dev-ai[bot]

@stelfrag stelfrag marked this pull request as ready for review

January 28, 2026 17:05

cubic-dev-ai[bot]

- Add detailed logging for refcount underflow and unexpected lifecycle violations.
- Ensure proper cleanup of PRD_ARRAY and detached references with spinlock protection.
- Refactor slot clearing logic to prevent races and double-releases during unslotting.
- Track memory being freed only when exclusive ownership is confirmed.
- Refine comments for better clarity on lifecycle handling and concurrency safeguards.
…a` references.

- Reacquire dimensions during slot cache growth for independent lifecycle management.
- Add detailed logging for slot cleanup and delayed free scenarios.
- Track memory only when exclusive ownership of old arrays is confirmed.
…y safety and prevent races.

@stelfrag

… PRD_ARRAY and chart slots. Fix thread safety issues, optimize slot growth logic, and enhance error logging.