When --unattended is specified, MOVE_SOURCE is enabled to remove source files after successful encoding. However, if the NFS server becomes unresponsive, rm -f can fail or hang indefinitely. Add a 5-second timeout to prevent hanging on unresponsive NFS mounts, and downgrade removal failures from critical errors to warnings. This allows the script to continue processing files even if source cleanup encounters transient NFS issues. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@@ -1897,13 +1897,15 @@ process_video_file() {
|
||
| 1897 | 1897 |
OUTPUT_BYTES_PROCESSED=$((OUTPUT_BYTES_PROCESSED + output_size_bytes)) |
| 1898 | 1898 |
|
| 1899 | 1899 |
if [[ "$MOVE_SOURCE" == true ]]; then |
| 1900 |
- if rm -f "$input_file"; then |
|
| 1900 |
+ if timeout 5s rm -f "$input_file" 2>/dev/null; then |
|
| 1901 | 1901 |
vlog_msg "INFO" "Removed source after successful validation: $input_file" |
| 1902 | 1902 |
else |
| 1903 |
- ERRORS=$((ERRORS + 1)) |
|
| 1904 |
- log_msg "ERROR" "Failed to remove source after validation: $input_file" |
|
| 1905 |
- cleanup_process_inputs "$staged_input_file" "$repacked_input_file" |
|
| 1906 |
- return 1 |
|
| 1903 |
+ local rm_rc=$? |
|
| 1904 |
+ if [[ $rm_rc -eq 124 ]]; then |
|
| 1905 |
+ log_msg "WARN" "Source file removal timed out (NFS unresponsive?): $input_file" |
|
| 1906 |
+ else |
|
| 1907 |
+ log_msg "WARN" "Could not remove source file: $input_file" |
|
| 1908 |
+ fi |
|
| 1907 | 1909 |
fi |
| 1908 | 1910 |
fi |
| 1909 | 1911 |
|