Hello,
I wanted to get an advice on the following issue.
We have several test configurations with Appium servers running constantly in 24/7 mode. Unfortunately, on all platforms Appium probably leaks – after a couple of days of intensive testing it eats all available memory, so the system becomes unresponsive.
To overcome this issue, I start Appium with a Python command
AppiumPID = subprocess.Popen(appium_cmd_line, cwd=my_work_dir).pid
and restart it between the tests:
p = psutil.Process(AppiumPID)
p.terminate()
p.wait()
AppiumPID = subprocess.Popen(appium_cmd_line, cwd=my_work_dir).pid
This method works perfectly for Windows and Android, but fails with testing on real iOS devices. Appium runs additional processes such as iproxy
, idevicesyslog
and xcodebuild
that survive this termination and prevent the restarted Appium server from operating properly.
I tried killing these processes independenly from Appium, but it turned out to be unreliable: eventually I am getting some of them still running in the background and hindering the tests.
So the question is: how to restart Appium programmatically “in the right way” with all these subprocesses? I think if I close the Appium shell window, they all terminate, but not 100% sure.
Thanks.