Appium throws org.openqa.selenium.remote.SessionNotFoundException: A session is either terminated or not started in a middle of a scenario, It takes more then 30 minutes to create a new page

Hi,
Environment details:
Java Client: 3.4.1
Appium: 1.5.3
Multiple (3) devices connected to same physical mac mini.

Description:
I face with 3 abnormal behaviours while execution. (Not constantly for all the 3 issues)

  1. It takes a lot of time (more then 30 minutes) to create a new IOSDriver()
  2. I’m using page object pattern, It takes more then 30 minutes to create a new page.
  3. I get org.openqa.selenium.remote.SessionNotFoundException: A session is either terminated or not started.
  • we run around 100 E2E tests using Cucumber.

Questions:

  1. Does someone share same issues?
  2. How to fix those issues?

Details:
Capabilities:
desiredCapabilities.setCapability(“bundleId”, driverConfig.getBundleId());
desiredCapabilities.setCapability(“waitForAppScript”, “true;”);
desiredCapabilities.setCapability(“newCommandTimeout”, Delays.COMMAND_TIMEOUT_DELAY);
desiredCapabilities.setCapability(“iCloudEmail”, driverConfig.getiCloudEmail());
desiredCapabilities.setCapability(“iCloudPassword”, driverConfig.getiCloudPassword());

Server flags:
" -p " + port + " " + “–session-override " +
" -g " + logFileName + " " + bport + " " + “–default-capabilities " +
udidString + " --tmp /tmp/” + port + " > /dev/null 2>&1 &”;

Thanks