in reply to strange failure of a system call

Perhaps:

One way to get more information (although it may make the whole thing run so slowly as to not reproduce the problem usefully) would be to run your script under strace -f. When the script exits, you should see the exit code of the child process and also whether it died to to a signal or not.