I’m running tests on a single Android device, and partway through the test executions, Appium is issued / receives a seemingly random shutdown command. This command does not come at a consistent time. Sometimes right after the first test, sometimes after six tests. Doesn’t seem to matter if the tests pass or fail. After the shutdown command, Appium seems to reboot and then hang.
I’m using Node v6.11.0, Appium v1.6.5.
I’m starting appium via the following:
appium -a localhost -p 4568 -bp 2295 -U eab61ed1 --nodeconfig config/config_4568.json
The config file specified is as below:
{
"capabilities":[
{
"browserName":"Chrome",
"maxInstances":1,
"platformName":"ANDROID",
"platform":"ANDROID"
}
],
"configuration":{
"unregisterIfStillDownAfter":60000,
"nodeStatusCheckTimeout":60000,
"hubHost":"localhost",
"hubPort":4444,
"timeout":60000,
"proxy":"org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"cleanUpCycle":5000,
"port":4568,
"newCommandTimeout":0,
"host":"localhost",
"maxSession":"1",
"registerCycle":10000,
"register":true
}
}
Appium log:
[HTTP] <-- POST /wd/hub/session/05c48ed1-5630-4310-b1ae-060a4b347144/elements 200 485 ms - 74
[HTTP] --> POST /wd/hub/session/05c48ed1-5630-4310-b1ae-060a4b347144/elements {"using":"css selector","value":"[href=\"/my/url\"]"}
[MJSONWP] Driver proxy active, passing request on via HTTP proxy
[debug] [JSONWP Proxy] Proxying [POST /wd/hub/session/05c48ed1-5630-4310-b1ae-060a4b347144/elements] to [POST http://127.0.0.1:8000/wd/hub/session/d9f0d4d5d3143f5b6f25fab98b7d862c/elements] with body: {"using":"css selector","value":"[href=\"/my/url\"]"}
[debug] [JSONWP Proxy] Got response with status 200: {"sessionId":"d9f0d4d5d3143f5b6f25fab98b7d862c","status":0,"value":[{"ELEMENT":"0.9263131373000004-1"}]}
[JSONWP Proxy] Replacing sessionId d9f0d4d5d3143f5b6f25fab98b7d862c with 05c48ed1-5630-4310-b1ae-060a4b347144
[HTTP] <-- POST /wd/hub/session/05c48ed1-5630-4310-b1ae-060a4b347144/elements 200 454 ms - 108
[HTTP] --> DELETE /wd/hub/session/05c48ed1-5630-4310-b1ae-060a4b347144 {}
[debug] [MJSONWP] Calling AppiumDriver.deleteSession() with args: ["05c48ed1-5630-4310-b1ae-060a4b347144"]
[debug] [BaseDriver] Event 'quitSessionRequested' logged at 1505758963742 (11:22:43 GMT-0700 (PDT))
[debug] [AndroidDriver] Shutting down Android driver
[debug] [AndroidDriver] Stopping chromedriver for context CHROMIUM
[debug] [Chromedriver] Changed state to 'stopping'
[debug] [JSONWP Proxy] Proxying [DELETE /] to [DELETE http://127.0.0.1:8000/wd/hub/session/d9f0d4d5d3143f5b6f25fab98b7d862c] with no body
[debug] [JSONWP Proxy] Got response with status 200: "{\"sessionId\":\"d9f0d4d5d3143f5b6f25fab98b7d862c\",\"status\":0,\"value\":null}"
[debug] [Chromedriver] Changed state to 'stopped'
[debug] [ADB] Pressing the HOME button
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running '/Users/me/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","eab61ed1","shell","input","keyevent",3]
[debug] [AndroidBootstrap] Sending command to android: {"cmd":"shutdown"}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"shutdown"}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type SHUTDOWN
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"status":0,"value":"OK, shutting down"}
[debug] [AndroidBootstrap] Received command result from bootstrap
[debug] [UiAutomator] Shutting down UiAutomator
[debug] [UiAutomator] Moving to state 'stopping'
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Closed client connection
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: numtests=1
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: stream=.
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: current=1
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS_CODE: 0
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS: stream=
[debug] [AndroidBootstrap] [UIAUTO STDOUT] Test results for WatcherResultPrinter=.
[debug] [AndroidBootstrap] [UIAUTO STDOUT] Time: 29.306
[debug] [AndroidBootstrap] [UIAUTO STDOUT] OK (1 test)
[debug] [AndroidBootstrap] [UIAUTO STDOUT] INSTRUMENTATION_STATUS_CODE: -1
[debug] [UiAutomator] UiAutomator shut down normally
[debug] [UiAutomator] Moving to state 'stopped'
[debug] [ADB] Attempting to kill all uiautomator processes
[debug] [ADB] Getting all processes with uiautomator
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running '/Users/me/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","eab61ed1","shell","ps"]
[ADB] No uiautomator process found to kill, continuing...
[debug] [UiAutomator] Moving to state 'stopped'
[debug] [Logcat] Stopping logcat capture
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running '/Users/me/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","eab61ed1","shell","am","force-stop","io.appium.unlock"]
[debug] [AndroidDriver] Not cleaning generated files. Add `clearSystemFiles` capability if wanted.
[Appium] Removing session 05c48ed1-5630-4310-b1ae-060a4b347144 from our master session list
[debug] [BaseDriver] Event 'quitSessionFinished' logged at 1505758966062 (11:22:46 GMT-0700 (PDT))
[debug] [MJSONWP] Received response: null
[debug] [MJSONWP] But deleting session, so not returning
[debug] [MJSONWP] Responding to client with driver.deleteSession() result: null
[HTTP] <-- DELETE /wd/hub/session/05c48ed1-5630-4310-b1ae-060a4b347144 200 2320 ms - 76
[HTTP] --> GET /wd/hub/status {}
[debug] [MJSONWP] Calling AppiumDriver.getStatus() with args: []
[debug] [MJSONWP] Responding to client with driver.getStatus() result: {"build":{"version":"1.6.5","revision":"0a95e77000515c1156be593642dd4e452f2f098e"}}
[HTTP] <-- GET /wd/hub/status 200 9 ms - 121
[HTTP] --> POST /wd/hub/session {"desiredCapabilities":{"javascriptEnabled":true,"locationContextEnabled":true,"handlesAlerts":true,"rotatable":true,"platformVersion":"7.0","appiumVersion":"1.6.5","browserName":"Chrome","platformName":"ANDROID","udid":"eab61ed1","deviceName":"eab61ed1","platform":"ANDROID","requestOrigins":{"url":"http://webdriver.io","version":"4.6.2","name":"webdriverio"}}}
[debug] [MJSONWP] Calling AppiumDriver.createSession() with args: [{"javascriptEnabled":true,"locationContextEnabled":true,"handlesAlerts":true,"rotatable":true,"platformVersion":"7.0","appiumVersion":"1.6.5","browserName":"Chrome","platformName":"ANDROID","udid":"eab61ed1","deviceName":"eab61ed1","platform":"ANDROID","requestOrigins":{"url":"http://webdriver.io","version":"4.6.2","name":"webdriverio"}},null,null]
[debug] [BaseDriver] Event 'newSessionRequested' logged at 1505758966950 (11:22:46 GMT-0700 (PDT))
[Appium] Creating new AndroidDriver (v1.20.0) session
[Appium] Capabilities:
[Appium] javascriptEnabled: true
[Appium] locationContextEnabled: true
[Appium] handlesAlerts: true
[Appium] rotatable: true
[Appium] platformVersion: '7.0'
[Appium] appiumVersion: '1.6.5'
[Appium] browserName: 'Chrome'
[Appium] platformName: 'ANDROID'
[Appium] udid: 'eab61ed1'
[Appium] deviceName: 'eab61ed1'
[Appium] platform: 'ANDROID'
[Appium] requestOrigins: { url: 'http://webdriver.io',
version: '4.6.2',
name: 'webdriverio' }
[debug] [AndroidDriver] AndroidDriver version: 1.20.0
[BaseDriver] The following capabilities were provided, but are not recognized by appium: javascriptEnabled, locationContextEnabled, handlesAlerts, rotatable, appiumVersion, platform, requestOrigins.
[BaseDriver] Session created with session id: 42a50ec9-14bf-47b7-8475-0e6c3a70bfc1
[debug] [AndroidDriver] Getting Java version
[AndroidDriver] Java version is: 1.8.0_131
[AndroidDriver] We're going to run a Chrome-based session
[AndroidDriver] Chrome-type package and activity are com.android.chrome and com.google.android.apps.chrome.Main
[ADB] Checking whether adb is present
[ADB] Using adb from /Users/me/Library/Android/sdk/platform-tools/adb
[AndroidDriver] Retrieving device list
[debug] [ADB] Trying to find a connected android device
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[AndroidDriver] Using device: eab61ed1
[ADB] Checking whether adb is present
[ADB] Using adb from /Users/me/Library/Android/sdk/platform-tools/adb
[debug] [ADB] Setting device id to eab61ed1
[AndroidDriver] App file was not listed, instead we're going to run com.android.chrome directly on the device
[debug] [AndroidDriver] Checking whether package is present on the device
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running '/Users/me/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","eab61ed1","shell","pm","list","packages","com.android.chrome"]
[AndroidDriver] Starting Android session
[debug] [ADB] Running '/Users/me/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","eab61ed1","wait-for-device"]
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running '/Users/me/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","eab61ed1","shell","echo","ping"]
[debug] [Logcat] Starting logcat capture
[debug] [AndroidDriver] Pushing settings apk to device...
[debug] [ADB] Getting install status for io.appium.settings
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running '/Users/me/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","eab61ed1","shell","pm","list","packages","io.appium.settings"]
[debug] [ADB] App is installed
[debug] [ADB] Getting package info for io.appium.settings
[debug] [ADB] Getting connected devices...
[ADB] Checking whether aapt is present
[ADB] Using aapt from /Users/me/Library/Android/sdk/build-tools/25.0.2/aapt
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running '/Users/me/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","eab61ed1","shell","dumpsys","package","io.appium.settings"]
[ADB] Cannot read version codes of /Users/me/.nvm/versions/node/v6.11.0/lib/node_modules/appium/node_modules/io.appium.settings/app/build/outputs/apk/settings_apk-debug.apk and/or io.appium.settings. Assuming correct app version is already installed
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running '/Users/me/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","eab61ed1","shell","getprop","ro.build.version.sdk"]
[debug] [ADB] Device API level: 24
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running '/Users/me/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","eab61ed1","shell","dumpsys","package","io.appium.settings"]
[debug] [AndroidDriver] Pushing unlock helper app to device...
[debug] [ADB] Running '/Users/me/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","eab61ed1","install","/Users/me/.nvm/versions/node/v6.11.0/lib/node_modules/appium/node_modules/appium-unlock/bin/unlock_apk-debug.apk"]
[debug] [ADB] Running '/Users/me/Library/Android/sdk/platform-tools/adb' with args: ["-P",5037,"-s","eab61ed1","install","/Users/me/.nvm/versions/node/v6.11.0/lib/node_modules/appium/node_modules/appium-unlock/bin/unlock_apk-debug.apk"]
I can’t figure this out. Any help would be appreciated.