Why do you say "randomly fails"? Do you consider a configurable timeout with an exception to be a random failure?

Yes. It will fail whenever something else in the system steals your CPU time. Calling code definitely isn't checking for errors either.