🔧 Error Handling & Resource Management Improvements
This release fixes critical error handling issues reported in Issue #1 and adds resource throttling to prevent system overload during parallel encoding.
🐛 Fixed
Error Messages & Debugging
- Fixed missing FFmpeg error details - Users now see complete FFmpeg stderr output instead of generic "Failed to encode track 0" messages
- Error context is preserved through async task boundaries
- Full error chain maintained for better debugging
- Resolves GitHub Issue #1
Error Retry Logic
- Fixed over-aggressive retry behavior - FFmpeg encoding errors are now correctly classified as permanent
- Added 20+ FFmpeg-specific error patterns
- Permanent errors (corrupted files, invalid codecs) no longer retry
- Saves time by immediately failing on non-recoverable errors
Error Visibility
- Added detailed error logging during retries
- Shows full error details on each retry attempt
- Displays remaining retry attempts
- Much better troubleshooting experience
✨ Added
Resource Throttling
- New config option:
max_concurrent_files_per_book(default: 8)- Prevents resource exhaustion when encoding books with many files
- Before: 40 files = 160 threads → System overload ❌
- After: 40 files = 32 threads → Predictable, safe ✅
- Configurable: "auto" for num_cpus, or 1-32
Semaphore-Based Concurrency Control
- Implemented per-book file encoding throttling
- Two-level control: Books level + Files level
- Prevents "too many open files" errors
📊 Performance Impact
Individual Books: ~2-3x slower with default throttling (acceptable trade-off for reliability)
Overall Reliability: Dramatically improved - no more crashes or resource exhaustion
Configurable: Set max_concurrent_files_per_book: "auto" on powerful systems for best performance
🔧 Configuration
Add to your config.yaml:
```yaml
performance:
max_concurrent_files_per_book: "8" # or "auto"
```
Backward Compatible: Missing field defaults to "8".
📦 Installation
```bash
cargo install audiobook-forge --force
```
Full Changelog: https://github.com/juanra/audiobook-forge/blob/main/CHANGELOG.md