I was working on a project, and I want to contribute with the solution I found:
The code is of the kind:
while true
do
while read VAR
do
......
done < <(find ........ | sort)
sleep 3
done
The errors in the log where:
/dir/script.bin: redirection error: cannot duplicate fd: Too many open files
/dir/script.bin: cannot make pipe for process substitution: Too many open files
/dir/script.bin: line 26: <(find "${DIRVAR}" -type f -name '*.pdf' | sort): Too many open files
find: `/somedirtofind': Too many open files
/dir/script.bin: cannot make pipe for process substitution: Too many open files
/dir/script.bin: cannot make pipe for process substitution: Too many open files
/dir/script.bin: line 26: <(find "${DIRVAR}" -type f -name '*.pdf' | sort): ambiguous redirect
I noticed with command:
ls -l /proc/3657(pid here)/fd that the file descriptors were constantly increasing.
Using Debian 7, GNU bash, version 4.2.37(1)-release (i486-pc-linux-gnu)