Skip to content

fix: prevent race condition in localfilesystem context store during shutdown#5462

Merged
knolleary merged 1 commit intonode-red:masterfrom
Dennis-SEG:fix/localfilesystem-race-condition-clean
Jan 26, 2026
Merged

fix: prevent race condition in localfilesystem context store during shutdown#5462
knolleary merged 1 commit intonode-red:masterfrom
Dennis-SEG:fix/localfilesystem-race-condition-clean

Conversation

@Dennis-SEG
Copy link
Copy Markdown
Contributor

Summary

Fixes #5450 - Race condition in localfilesystem context store that can cause data loss during shutdown.

May also help with #2723 (localFileSystem data cleared after power failure).

Changes

  1. Added closing flag that is set at the start of close()
  2. Check this flag in set() to prevent scheduling new timeouts during shutdown
  3. Always flush pending writes in close() regardless of timeout state

Test Plan

  • All existing context store tests pass
  • Manual testing with rapid shutdown during writes

@knolleary knolleary merged commit 89db8f0 into node-red:master Jan 26, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Race condition in localfilesystem context store during shutdown

2 participants