Sauce lab no such Session Exception

When i running test on sauce lab then after sometime nosuchSessionexception is thrown by sauce lab. I am unable to execute test.
Also want to know in which case we require xcodeOrgid and xcodeDeveloperId to run on real device as when i running test on real device on sauce lab then i do not need these capabilities to set.