appium: Appium 1.7.1 Encountered internal error running command: Error: Could not proxy. Proxy error: Could not proxy command to remote server. Original error: Error: socket hang up

The problem

I am running test scripts using appium 1.7.1 with uiautomator2 for testing android apps. While running i am getting Error Encountered internal error running command: Error: Could not proxy. Proxy error: Could not proxy command to remote server. Original error: Error: socket hang up at doJwpProxy$ (../../../lib/mjsonwp/mjsonwp.js:384:13) at tryCatch (/usr/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40) at GeneratorFunctionPrototype.invoke [as _invoke] (/usr/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22) at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (/usr/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21) at GeneratorFunctionPrototype.invoke (/usr/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)

I am using appium-python-robotframework for writing test scripts. The above error occurs when I am using uiautomator2 for testing Android phones with v7 and above. The automation runs fine when I am using automationName=appium for testing Android phones below v7.

Some times I am getting the ECONNRESET error in between the test cases: WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Could not proxy command to remote server. Original error: Error: read ECONNRESET

I am getting these two errors switching in between as random. Some of the test cases passes without fail. But some fails with these errors.

Environment

  • Appium version (or git revision) that exhibits the issue: Appium v1.7.1
  • Desktop OS/version used to run Appium: Ubuntu 16.04
  • Node.js version (unless using Appium.app|exe): $ node --version v7.10.1
  • Mobile platform/version under test: Android v 7.0
  • Real device or emulator/simulator: real device
  • Appium CLI or Appium.app|exe: Appium CLI

Details

The uiautomator2 version I am using is: $ npm list -g appium-uiautomator2-driver /usr/lib -- appium@1.7.1 -- appium-uiautomator2-driver@0.6.5

Link to Appium logs

https://gist.github.com/KrishnaprabhaSNaik/7507aab60ab4bb30acf42711a93040b8

This is my link to the appium log.

Code To Reproduce Issue [ Good To Have ]

OpenApplication ${Appium_server} platformName=${Platform_name} platformVersion=${Platform_version} deviceName=${Device_names["${Platform_Version}"]} app=${file_path}/Resources/${Application_APK_name} appActivity=${Activity_name} appPackage=${Package_name} automationName=uiautomator2

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 5
  • Comments: 49

Most upvoted comments

Changing from uiautomator2 to appium is not a solution. Appium server is not supported for android 7+.

Changing “automationName”: “uiautomator2” to

“automationName”: “appium”

fixed this for non-primary User accounts. 😃

This works for me:

adb -s UDID uninstall io.appium.uiautomator2.server adb -s UDID uninstall io.appium.uiautomator2.server.test adb -s UDID uninstall io.appium.unlock adb -s UDID uninstall io.appium.settings

happens 10x a day for me on Android…literally cannot run tests on my devices.

I had same issue and solved it:

  • quit the every driver instances after test ends.

Hi all, I think I am now able to figure out the reason behind these issues. When we run the automation script on Android version 7 and above I was able to see that the actions taking place on phone is much faster than the command being sent or executed by appium (which can be seen in the terminal while running appium). Suppose the scenario for testing is, we are moving to next screen by tapping a continue button and then searching for another element in the next screen to ensure that we have reached in next screen. Here I could see the continue button is tapped and screen has gone to next screen. But in the terminal where we run appium, I could see appium still searching for next button for tapping. But it will never find the element since it has reached the screen2 and finally after reaching a particular timeout it gives us a error like ECCONRESET, SOCKET HANG UP etc. So then I put sleep command at all places where I was getting these errors. I put sleep command just before the keyword for which the appium was not able to find out the element. After that it is working properly for all devices either for below 7 or above 7.

@KrishnaprabhaSNaik removing packages with adb uninstall fixed it for me. package:io.appium.settings package:io.appium.uiautomator2.server package:io.appium.uiautomator2.server.test package:io.appium.unlock

@KrishnaprabhaSNaik removing packages with adb uninstall fixed it for me. package:io.appium.settings package:io.appium.uiautomator2.server package:io.appium.uiautomator2.server.test package:io.appium.unlock

It also works for me.

@JaysonPidgeon There is nothing to do on appium side for this kind of problems. They are usually happening because the device/the connection to it itself is not very stable or the operating system shuts down the automation server or there is a bug in uiautomator2 framework.

However, if you can provide all the detailed logs with server exception tracebacks then feel free to create a new issue.

Can someone reopen this issue as it seems to have been closed after an invalid solution was submitted?

os.popen("adb uninstall io.appium.uiautomator2.server.test")
os.popen("adb uninstall io.appium.uiautomator2.server")
os.popen("adb install -r "+PATH("../app/appium-uiautomator2-server-v0.1.9.apk"))
os.popen("adb install -r "+PATH("../app/appium-uiautomator2-server-debug.androidTest.apk"))

like this setting, it works for me

I FINALLY FIXED THIS.

Removing the adb packages would work however it would have to reinstall every run and it took a bit longer than i wanted. After using that for awhile I just recently discovered the source of all my agony… using driver.close() rather than driver.quit() in my destructor.

If you’re not using either, or you’re using drive.close() after you’re done, then try using driver.quit() after you’ve finished.

This happens to our Android every day. It happens on different steps randomly. Still trying to find a way to resolve it. Appium 1.9.1 is slightly better, Appium 1.9.0 happens more frequently.

It fixed the issue for a while, its has something to do with proxy server and ports, try to set wdaPort for each ios device and will be back with settings i used for Andoird soon as possible.