GPipe isn't thread safe. I've removed -threaded flag and all problems
with race conditions in gpipe pipeline have gone.