- Added ClamAV security configuration to enhance scanning efficiency for critical file types. - Introduced deduplication optimization with a 1GB threshold to bypass SHA256 computation for large files, improving upload speed. - Resolved "endless encryption" issue by disabling deduplication for large files and allowing video file extensions in global settings. - Enhanced upload performance verification scripts to monitor and validate upload processes and configurations. - Updated monitoring scripts for real-time log analysis and upload activity tracking. - Documented all changes and configurations in respective markdown files for clarity and future reference.
3.5 KiB
3.5 KiB
Upload Completion Issue - Diagnostic & Fix
Problem Analysis
User Report
- ✅ Upload starts correctly: HMAC validation working
- ✅ Transfer completes: File uploads without "endless encryption" delay
- ❌ Final step fails: "Not found" error after upload completion
Root Cause Identified
The issue occurs in the final storage step, specifically in the deduplication process:
Deduplication Process Steps
- File Upload: ✅ Completes successfully
- SHA256 Computation: ✅ Working (now skipped for files >1GB)
- File Movement: ❌
os.Rename()
andos.Link()
operations failing - Hard Link Creation: ❌ Causing "not found" response
Technical Details
// From helpers.go - Deduplication process
if err := os.Rename(absFilename, existingPath); err != nil {
log.Warnf("Failed to move file for deduplication: %v", err)
return nil // Don't fail upload - BUT THIS MIGHT STILL CAUSE ISSUES
}
if err := os.Link(existingPath, absFilename); err != nil {
log.Warnf("Failed to create link after deduplication: %v", err)
// File restoration attempt may fail
return nil
}
Fix Applied
Immediate Solution
# Temporarily disabled deduplication to isolate the issue
deduplication_enabled = false
Testing Strategy
- Upload with deduplication disabled: Should complete successfully
- Monitor file storage: Verify files appear in upload directory
- Check for "not found" errors: Should be eliminated
- Confirm client success: XMPP clients should show successful upload
Expected Results
Before Fix (with deduplication)
Upload Process:
1. HMAC validation: ✅ Success
2. File transfer: ✅ Success
3. File created: ✅ Success
4. Deduplication: ❌ Hard link failure
5. Client response: ❌ "Not found"
After Fix (deduplication disabled)
Upload Process:
1. HMAC validation: ✅ Success
2. File transfer: ✅ Success
3. File stored directly: ✅ Success
4. Deduplication: ⏭️ Skipped
5. Client response: ✅ Success
Long-term Solution Options
Option 1: Fix Deduplication Hard Links
- Investigate NFS hard link limitations
- Implement fallback to file copying instead of linking
- Add better error handling for link failures
Option 2: Disable Deduplication for Large Files Only
- Keep deduplication for small files (where it works)
- Disable only for large files that were causing issues
- Maintains storage efficiency for smaller files
Option 3: Alternative Deduplication Strategy
- Use symbolic links instead of hard links
- Implement reference counting system
- Store deduplicated files in separate location
Monitoring & Verification
Test Script Created
/root/hmac-file-server/test_upload_completion.sh
Real-time Monitoring
- nginx access logs
- HMAC server logs
- Upload directory file creation
- Client response verification
Current Status
✅ Deduplication disabled to eliminate the storage failure
✅ Upload speed optimized (1GB limit prevents SHA256 delays)
✅ Server running with simplified storage process
🔄 Testing phase to confirm fix resolves "not found" issue
Next Steps
- Test upload completion with current configuration
- Verify client success (no more "not found" errors)
- Decide on long-term deduplication strategy based on test results
- Re-enable optimized deduplication if hard link issues can be resolved
Issue: Final storage step failing in deduplication process
Fix: Deduplication temporarily disabled
Status: Testing upload completion