-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Labels
area:task-managementCore task management featuresCore task management featuresbugSomething isn't workingSomething isn't workinghigh-priorityUrgent issue requiring immediate attentionUrgent issue requiring immediate attentionprovider:claude-codeClaude Code integrated modelsClaude Code integrated models
Description
Problem
When multiple Claude Code windows (separate processes) access Task Master simultaneously, the JSON file can get corrupted or work that Task Master claims to have saved is lost.
Root Cause
The readJSON() and writeJSON() functions in scripts/modules/utils.js had no file locking mechanism:
- Multiple processes could read the same file simultaneously
- Each process would make changes to its copy
- When writing, later writes would overwrite earlier ones, losing updates
Additionally, the _rawTaggedData snapshot pattern caused stale data issues - a snapshot taken at read time could become outdated by the time the write occurred.
Impact
- Data loss when multiple Claude Code sessions work on the same project
- Corrupted tasks.json file
- Lost task updates, status changes, and subtask modifications
Solution
Implemented in PR #1566:
- Cross-process file locking using
proper-lockfile(async) and custom lock files with exclusivewxflag (sync) - Atomic writes using temp file + rename pattern
- Re-read file inside lock to get current state
- Stale lock detection and automatic cleanup (10-second timeout)
Reproduction Steps
- Open multiple Claude Code windows on the same project
- Have both windows make Task Master operations simultaneously (e.g., set-status, update-subtask)
- Observe that some changes are lost or file becomes corrupted
ilmarioranen
Metadata
Metadata
Assignees
Labels
area:task-managementCore task management featuresCore task management featuresbugSomething isn't workingSomething isn't workinghigh-priorityUrgent issue requiring immediate attentionUrgent issue requiring immediate attentionprovider:claude-codeClaude Code integrated modelsClaude Code integrated models
Projects
Status
Done