We let thousands of tiles undergo the same time consuming processing tasks. We use a multi core Windows 7 workstation running several tiles simultaneously in separate shell windows (parallel processing). A batch script controls the work flow of the task with gawk interpreting a number of setup / definition files at run time for each tile / working step. From time to time we get "Bad File Descriptor" errors in gawk (and, e.g., cat, head, tail) when accessing these setup files (they are only read). The full error line reads similar to:
(With job.awk and first access to datafile.txt at gawk source line 31:)
"gawk: job.awk:31: fatal: error reading input file `datafile.txt': Bad file descriptor"
(With inline gawk scripts typically:)
"gawk: fatal: error reading input file `datafile.txt': Bad file descriptor"
(With something like "cat datafile.txt > destination":)
"cat: datafile.txt: Bad file descriptor"
We use MS-Windows shell cmd.exe with batch scripts executing the gawk and other commands.
I tried to use gawk's BEGINFILE rule in order to trap that error. However, the BEGINFILE block is never entered, rather, gawk immediately crashes with the "Bad File Descriptor" error.