appium icon indicating copy to clipboard operation
appium copied to clipboard

UiAutomator2 with parallel execution gives "Encountered internal error running command: ProxyRequestError: Could not proxy command to remote server. Original error: Error: socket hang up"

Open derinbay opened this issue 8 years ago • 13 comments

The problem

I'm trying to start tests in parallel with android emulator registered to a selenium grid. All emulators has same options except for ports and ips. So I start a test, I want grid starts the tests on any available emulator. With uiaotomator2, it gives me "Encountered internal error running command: ProxyRequestError: Could not proxy command to remote server. Original error: Error: socket hang up" error.

Environment

  • Appium version (or git revision) that exhibits the issue: 1.7.2beta (also tried with 1.7.1)
  • Desktop OS/version used to run Appium: MacOS Sierra 10.12.6
  • Node.js version (unless using Appium.app|exe): 9.2.1
  • Mobile platform/version under test: Android Emulator 7.1
  • Real device or emulator/simulator: genymotion emulator

Details

I registered 3 emulator to selenium grid. register scripts: https://gist.github.com/derinbay/82081fbb94a96dafd9a7753aa77fbf58 nodeconfig1: https://gist.github.com/derinbay/275b9adbfb414c1077f6e171b26a43a2 nodeconfig2: https://gist.github.com/derinbay/48e19be010469c5ed3f14b0752c1cb4d nodeconfig3: https://gist.github.com/derinbay/3a944eca6dd9ea6ecc47009460e38f5a

When I started my tests from remote, it gives me these errors. First appium gives proxy error, second and third cannot find uiauomator.apk (appium-uiautomator2-server-v0.2.0.apk file doesn't exist), but it is there.

My startup script with capabilities: https://gist.github.com/derinbay/8d181ec45bfbe2b493aca5113c0691d2

Link to Appium logs

Logs for 1st emulator: https://gist.github.com/derinbay/b76e7493e625bd5fb53d2eee352a3791 Logs for 2nd emulator: https://gist.github.com/derinbay/35e9c780f8d27177f9376fe65de2f637 Logs for 3rd emulator: https://gist.github.com/derinbay/0204cc808bc9431d2b42a2f1d2ad2286

When I run the same parameters, except UiAutomator2, it works as I wanted.

Thanks in advance

derinbay avatar Dec 11 '17 10:12 derinbay

Do you follow https://github.com/appium/appium/blob/55760b7b9e1c494c6a1f22d152f0bd1fe676dae7/docs/en/advanced-concepts/parallel-tests.md ?

mykola-mokhnach avatar Dec 11 '17 10:12 mykola-mokhnach

I've set systemPorts at nodeConfig files also, but the result is same.

By the way I'm sending udid as null on my desired capabilities, because I want test to be open on any available emulator, not a specific one. Can that be related?

derinbay avatar Dec 11 '17 12:12 derinbay

Found the problem I've added systemPort as a parameter to appium when starting, not inside the nodeConfig file.

appium -a 172.20.0.181 -p 4723 --session-override -bp 4733 -U 192.168.56.101:5555 --nodeconfig appiumnodeconfig1.json --default-capabilities "{\"systemPort\":8200}"

Thanks @mykola-mokhnach

derinbay avatar Dec 11 '17 12:12 derinbay

@derinbay Hello, reading your last message, looks like you successfully run tests on parallel android. Is it ok ? Because I've tried exactly the same json and appium command, with UiAutomator2, and appium still want to launch the 2 tests in the same device even both are connected to the grid. Like you I can't put an udid in my caps because I want appium looks for available device. Thanks a lot.

ericzered avatar Mar 21 '18 15:03 ericzered

@ericzered Yes it's working on parallel with different devices. You should set udid while registering. You have to give same deviceName and version for all devices, if you want your test to start on any available devices.

I'm using someting like this for a real device:

{
  "capabilities": [
{
  "version": "5.0",
  "browserName": "android",
  "maxInstances": 1,
  "deviceName": "g3"
}
  ],
  "configuration": {
"nodeTimeout" : 120,
"proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"url": "http://172.20.0.181:4728/wd/hub",
"hub": "172.20.0.223:4444/grid/register",
"hubHost": "172.20.0.223",
"hubPort": 4444,
"register": true,
"maxSession": 1,
"nodePolling": 5000,
"registerCycle": 5000  
  }
}

Register link to selenium grid is:

appium -a 172.20.0.181 -p 4728 --session-override -bp 4738 --nodeconfig appiumnodeconfig-g3.json --default-capabilities "{\"udid\":\"LGD855b4102087\",\"systemPort\":8205}"

derinbay avatar Apr 02 '18 09:04 derinbay

Thanks, it's working with your setup ! Last problem I've got now is that if I put a "MaxInstance" > number of device connected in my test capabilities, I've got some errors because some appium session receive several instances. So I have to know before testing how many devices are connected to put this value to MaxInstance. Thanks again !

ericzered avatar Apr 03 '18 07:04 ericzered

@ericzered I'm glad that it works. For the connected devices, you can use grid api. You can extract slotCounts/total count from http://seleniumgrid:4444/grid/api/hub/

derinbay avatar Apr 03 '18 08:04 derinbay

Thanks, that was exactly our first conclusion this morning :) Have a nice day

ericzered avatar Apr 03 '18 08:04 ericzered

why test script is working on only one node?

mskornyakova avatar Jul 12 '18 15:07 mskornyakova

@mykola-mokhnach @derinbay can you please share android driver capabilities ? i have strange things that happen when running in parallel on multiple devices, but all well when running on 1 device. Thanks

selenUser avatar Jul 26 '18 15:07 selenUser

@selenUser capabilities

derinbay avatar Jul 27 '18 11:07 derinbay

@derinbay thanks

selenUser avatar Jul 29 '18 15:07 selenUser

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

lock[bot] avatar Jul 29 '19 16:07 lock[bot]