In an attempt to work around https://issuetracker.google.com/issues/73230216, I replaced the use of adb with fb-adb in the supplied script
#!/bin/bash
while : ; do
OUTPUT=$(fb-adb -e shell 'echo -n exitcode')
if [[ ! "$OUTPUT" =~ "exitcode" ]]; then
echo "invalid adb output: $OUTPUT"
break
fi
done
Then I started the emulator (an android-26 x86_64 image) and ran the 6 copies of the shell script. After a few minutes, fb-adb fails with:
fb-adb shell: error in stub: fork: Try again