[HDRI] SMP file busy problem on iterative rendering in Linux

Hi Chris,

I'm cross-posting answer to Radiance-general where this probably belongs. You should subscribe there if you aren't already.

Your error message is very strange. I'd be interested to hear if others have run across this before. It seems related to attempts to change or remove files that are currently being used as executables. It doesn't really make sense to me in the context of your script. This is one of the pages Google pointed me to:

  http://www.cyberciti.biz/faq/binbash-bad-interpreter-text-file-busy/

Best,
-Greg

···

Begin forwarded message:

From: Chris Kallie <[email protected]>
Date: January 31, 2014 10:13:46 AM PST

Dear Radiance Users,

I've assembled a simple script that iterates through a folder containing octrees, and renders using SMP. On Mac, everything works as expected. However, on Linux, I get errors suggesting both the syncfile and ppfile are still locked by the OS. I've attempted two solutions, including adding 'sleep 5' after pfilt (first attempt, shown below), and then by externalizing the while loop, with an ending 'exit 0' (second attempt, not shown here), but neither approach fixed the problem.

Here is one version of code which works on Mac but not in Linux:

for file in obj/*.oct
do
   filename="${file%.*}"
   rm -f syncfile argsfile ppfile
   echo 1 64 > syncfile
   cat syncfile
   echo -F syncfile @arguments -vf room.vf -o $filename.unf $filename.oct > argsfile
   cat argsfile
   NCPU=2
   while [ "$NCPU" -gt 0 ]
   do
       echo "running proc $NCPU"
       rpiece -v -PP ppfile @argsfile &
       sleep 5
       NCPU=`expr $NCPU - 1`
   done
   wait
   echo "Filtering File - $filename.unf"
   pfilt -1 -e -2 -m .25 -r .6 -x /3 -y /3 $filename.unf > $filename.hdr
   sleep 5
   rm -f syncfile argsfile ppfile
done

Interestingly, I do not get an error saying "cannot remove 'argsfile' ". After the first image is successfully rendered, I get the following errors at each successive iteration, indicating the rm only works once (line 4) in the first iteration:

rm: cannot remove 'syncfile': Text file busy
rm: cannot remove 'ppfile': Text file busy
rm: cannot remove 'syncfile': Text file busy
rm: cannot remove 'ppfile': Text file busy

Since the error isn't fatal, the machine keeps rendering, and ends up rendering the same (first) image over and over. Has anyone run into this problem and found a solution? Any advice would be greatly appreciated.

Thanks,
Chris