Bob, Yes I agree with everything you've said. I am grasping at straws, which I really don't like. It's very unlikely that the problems are with any of these things I've mentioned bash, Linux kernel, compiler, libc etc. This script is fairly large and it does lots of checking of block devices, raid arrays, and volumes. All of it is executed synchronously which should make it simple to debug. The script itself is executed in the background as a daemon process. This script is executed on locally mounted RAID devices. No network involved in the test.
I'll continue my search for root cause with a more disciplined approach. Thanks for the help.