docs: Worker data integrity check fix report
Changes: - Added traced_faces/ directory existence check - Added file count check (must be > 0) - Auto-cleanup incomplete face_traced.json - Prevents false "already done" detection Benefits: - Ensures data integrity before skipping - Auto-repairs incomplete traces - Better logging with file counts Remaining for 020.mp4: - Kill zombie worker (PID 16244) - Restart worker with new binary - Reset DB status
This commit is contained in:
@@ -0,0 +1,112 @@
|
|||||||
|
---
|
||||||
|
title: Worker Data Integrity Check Fix
|
||||||
|
version: 1.0
|
||||||
|
date: 2026-09-27
|
||||||
|
author: OpenCode
|
||||||
|
status: fixed
|
||||||
|
---
|
||||||
|
|
||||||
|
## Problem
|
||||||
|
|
||||||
|
Worker status check logic flawed:
|
||||||
|
|
||||||
|
**Before:**
|
||||||
|
```rust
|
||||||
|
if face_traced_json.exists() {
|
||||||
|
skip_face_trace(); // ❌ No data check
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Impact:**
|
||||||
|
- Marked incomplete traces as complete
|
||||||
|
- Didn't verify traced_faces/ directory
|
||||||
|
- Didn't check if directory has files
|
||||||
|
- Pipeline stuck waiting for missing data
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Solution
|
||||||
|
|
||||||
|
**After:**
|
||||||
|
```rust
|
||||||
|
let trace_complete = if face_traced_json.exists() {
|
||||||
|
if traced_faces_dir.exists() {
|
||||||
|
let file_count = read_dir(traced_faces_dir).count();
|
||||||
|
if file_count > 0 {
|
||||||
|
true // ✅ Complete
|
||||||
|
} else {
|
||||||
|
remove_file(face_traced_json); // Clean up
|
||||||
|
false // Re-run
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
remove_file(face_traced_json);
|
||||||
|
false
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
false
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Checks Added
|
||||||
|
|
||||||
|
1. ✅ face_traced.json exists
|
||||||
|
2. ✅ traced_faces/ directory exists
|
||||||
|
3. ✅ Directory has files (file_count > 0)
|
||||||
|
4. ✅ Auto-cleanup incomplete traces
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Benefits
|
||||||
|
|
||||||
|
- **Prevents false positives**: Won't skip incomplete traces
|
||||||
|
- **Auto-repair**: Removes incomplete face_traced.json
|
||||||
|
- **Data integrity**: Ensures all required files present
|
||||||
|
- **Better logging**: Shows file count on success
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Remaining Issues
|
||||||
|
|
||||||
|
For 020.mp4 specifically:
|
||||||
|
|
||||||
|
1. **Zombie Worker process** (PID 16244)
|
||||||
|
- Running non-existent binary
|
||||||
|
- Need to kill and restart
|
||||||
|
|
||||||
|
2. **Database state**
|
||||||
|
- processing_status still shows old state
|
||||||
|
- Need to reset after restarting worker
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Deployment
|
||||||
|
|
||||||
|
1. Build new binary: `cargo build --bin momentry`
|
||||||
|
2. Kill zombie worker: `kill 16244`
|
||||||
|
3. Start new worker with debug binary
|
||||||
|
4. Reset DB status for stuck files
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Testing
|
||||||
|
|
||||||
|
Recommended tests:
|
||||||
|
- Face detection with no faces
|
||||||
|
- Face detection with faces, but missing traced_faces/
|
||||||
|
- Face detection with empty traced_faces/
|
||||||
|
- Complete face tracing pipeline
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Files Changed
|
||||||
|
|
||||||
|
- `src/worker/job_worker.rs`: Lines 2782-2834
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Related
|
||||||
|
|
||||||
|
- `2026-09-27_pipeline_architecture_flaws.md`
|
||||||
|
- `2026-09-27_020mp4_root_cause_zombie_worker.md`
|
||||||
Reference in New Issue
Block a user