Handle failure to read JSON waiting for server start

If the test controller tries to read the file while the server it has
started is in the middle of writing it, it gets invalid JSON and fails.

This just loops again until we have valid JSON to read.
Merge pull request #5824 from takluyver/testcontroller-json-error

Handle failure to read JSON waiting for server start