Socket hang up. Cannot launch app

following the Log from appium:MJSONWP] Encountered internal error running command: ProxyRequestError: Could not proxy command to remote server. Original error: Error: socket hang up
at JWProxy.proxy$ (lib/jsonwp-proxy/proxy.js:122:13)
at tryCatch (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)

Can someone help me to resolve this problem please?
thank you

Could be due to iproxy still continuing to run from previous test.

Before starting the tests, kill iproxy using:
ps -ax|grep -i “iproxy”|grep -v grep|awk ‘{print "kill -9 " $1}’|sh

from jslipps thread.

Hallo massiva i’ve tried it but without success!
following the log from Appium:
[MJSONWP] Calling AppiumDriver.getStatus() with args: []

[MJSONWP] Responding to client with driver.getStatus() result: {“build”:{“version”:"1.6.0-…

[HTTP] <-- GET /wd/hub/status 200 12 ms - 127

[HTTP] --> POST /wd/hub/session {“desiredCapabilities”:{“deviceName”:“android-e6c95345c872b977”,“name”:“Sample Test”,“automationName”:“uiautomator2”,“appiumVersion”:“1.6.0-beta3”,“browserName”:"",“platformVersion”:“6.0.1”,“appPackage”:“com.porsche.connect.r”,“platformName”:“Android”,“appActivity”:“de.porsche.pcc.MainActivity”}}

[MJSONWP] Calling AppiumDriver.createSession() with args: [{“deviceName”:"android-e6c…

[Appium] Creating new AndroidUiautomator2Driver session
[Appium] Capabilities:
[Appium] deviceName: ‘android-e6c95345c872b977’
[Appium] name: ‘Sample Test’
[Appium] automationName: ‘uiautomator2’
[Appium] appiumVersion: ‘1.6.0-beta3’
[Appium] browserName: ‘’
[Appium] platformVersion: ‘6.0.1’
[Appium] appPackage: ‘com.porsche.connect.r’
[Appium] platformName: ‘Android’
[Appium] appActivity: ‘de.porsche.pcc.MainActivity’
[Appium] dontStopAppOnReset: true
[BaseDriver] The following capabilities were provided, but are not recognized by appium: name, appiumVersion.
[BaseDriver] Session created with session id: 42b06031-6153-490f-8a7f-94d178a38639
[debug] [AndroidDriver] Getting Java version
[AndroidDriver] Java version is: 1.8.0_60
[ADB] Checking whether adb is present

[ADB] Using adb from /Users/ConnectMacOne/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] Looking for a device with Android ‘6.0.1’
[debug] [ADB] Setting device id to 330068990d10a247
[ADB] Getting device platform version
[debug] [ADB] Getting connected devices…
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running ‘/Users/ConnectMacOne/Library/Android/SDK/platform-tools/adb’ with args: ["-P",5037,"-s",“330068990d10a247”,“shell”,“getprop”,“ro.build.version.release”]
[AndroidDriver] Using device: 330068990d10a247
[ADB] Checking whether adb is present
[ADB] Using adb from /Users/ConnectMacOne/Library/Android/SDK/platform-tools/adb
[debug] [ADB] Setting device id to 330068990d10a247
[AndroidDriver] No app sent in, not parsing package/activity
[ADB] Getting device platform version
[debug] [ADB] Getting connected devices…
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running ‘/Users/ConnectMacOne/Library/Android/SDK/platform-tools/adb’ with args: ["-P",5037,"-s",“330068990d10a247”,“shell”,“getprop”,“ro.build.version.release”]
[debug] [ADB] Attempting to kill all io.appium.uiautomator2.server processes
[debug] [ADB] Getting all processes with io.appium.uiautomator2.server
[debug] [ADB] Getting connected devices…

[debug] [ADB] 1 device(s) connected

[debug] [ADB] Running ‘/Users/ConnectMacOne/Library/Android/SDK/platform-tools/adb’ with args: ["-P",5037,"-s",“330068990d10a247”,“shell”,“ps”]

[ADB] No io.appium.uiautomator2.server process found to kill, continuing…

[debug] [ADB] Running ‘/Users/ConnectMacOne/Library/Android/SDK/platform-tools/adb’ with args: ["-P",5037,"-s",“330068990d10a247”,“wait-for-device”]
[debug] [ADB] Getting connected devices…
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running ‘/Users/ConnectMacOne/Library/Android/SDK/platform-tools/adb’ with args: ["-P",5037,"-s",“330068990d10a247”,“shell”,“echo”,“ping”]
[debug] [Logcat] Starting logcat capture

[debug] [AndroidDriver] Pushing settings apk to device…
[debug] [ADB] Running ‘/Users/ConnectMacOne/Library/Android/SDK/platform-tools/adb’ with args: ["-P",5037,"-s",“330068990d10a247”,“install”,"/usr/local/lib/node_modules/appium/node_modules/io.appium.settings/bin/settings_apk-debug.apk"]

[debug] [AndroidDriver] Pushing unlock helper app to device…

[debug] [ADB] Running ‘/Users/ConnectMacOne/Library/Android/SDK/platform-tools/adb’ with args: ["-P",5037,"-s",“330068990d10a247”,“install”,"/usr/local/lib/node_modules/appium/node_modules/appium-unlock/bin/unlock_apk-debug.apk"]

[debug] [ADB] Forwarding system: 8200 to device: 6790

[debug] [ADB] Running ‘/Users/ConnectMacOne/Library/Android/SDK/platform-tools/adb’ with args: ["-P",5037,"-s",“330068990d10a247”,“forward”,“tcp:8200”,“tcp:6790”]

[debug] [ADB] Getting connected devices…
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running ‘/Users/ConnectMacOne/Library/Android/SDK/platform-tools/adb’ with args: ["-P",5037,"-s",“330068990d10a247”,“shell”,“dumpsys”,“window”]

[AndroidDriver] Screen already unlocked, doing nothing

[debug] [AndroidDriver] Extracting strings from apk null null /var/folders/9r/515nz7853kl6x7y3pc4pjqb80000gn/T/com.porsche.connect.r
[debug] [ADB] Extracting strings for language: default
[debug] [ADB] Getting connected devices…
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running ‘/Users/ConnectMacOne/Library/Android/SDK/platform-tools/adb’ with args: ["-P",5037,"-s",“330068990d10a247”,“shell”,“getprop”,“ro.build.version.sdk”]
[debug] [ADB] Device API level: 23
[debug] [ADB] Getting connected devices…

[debug] [ADB] 1 device(s) connected

[debug] [ADB] Running ‘/Users/ConnectMacOne/Library/Android/SDK/platform-tools/adb’ with args: ["-P",5037,"-s",“330068990d10a247”,“shell”,“getprop”,“persist.sys.locale”]
[debug] [ADB] Current device property ‘persist.sys.locale’: en-GB

[debug] [ADB] No strings.xml for language ‘en’, getting default strings.xml

[debug] [ADB] Getting connected devices…

[debug] [ADB] 1 device(s) connected

[debug] [ADB] Running ‘/Users/ConnectMacOne/Library/Android/SDK/platform-tools/adb’ with args: ["-P",5037,"-s",“330068990d10a247”,“shell”,“rm”,"-rf","/data/local/tmp/strings.json"]
[debug] [UiAutomator2] No app capability. Assuming it is already on the device
[debug] [AndroidDriver] Running fast reset (stop and clear)
[debug] [ADB] Getting connected devices…
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running ‘/Users/ConnectMacOne/Library/Android/SDK/platform-tools/adb’ with args: ["-P",5037,"-s",“330068990d10a247”,“shell”,“am”,“force-stop”,“com.porsche.connect.r”]

[debug] [ADB] Getting connected devices…

[debug] [ADB] 1 device(s) connected

[debug] [ADB] Running ‘/Users/ConnectMacOne/Library/Android/SDK/platform-tools/adb’ with args: ["-P",5037,"-s",“330068990d10a247”,“shell”,“pm”,“clear”,“com.porsche.connect.r”]

[debug] [ADB] Attempting to kill all io.appium.uiautomator2.server processes

[debug] [ADB] Getting all processes with io.appium.uiautomator2.server
[debug] [ADB] Getting connected devices…

[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running ‘/Users/ConnectMacOne/Library/Android/SDK/platform-tools/adb’ with args: ["-P",5037,"-s",“330068990d10a247”,“shell”,“ps”]
[ADB] No io.appium.uiautomator2.server process found to kill, continuing…
[UiAutomator2] Starting uiautomator2 server with cmd: am,instrument,-w,io.appium.uiautomator2.server.test/android.support.test.runner.AndroidJUnitRunner
[UiAutomator2] Waiting for UiAutomator2 to be online…
[JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body

[UiAutomator2] running command…
adb shell am instrument -w io.appium.uiautomator2.server.test/android.support.test.runner.AndroidJUnitRunner…

[JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body

[JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body

[JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body

[JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body

[JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body

[JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body

[JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body

[JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body

[JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body

[JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body

[JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body

[JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body

[JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body

[JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body

[JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body

[JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body

[JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body

[JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body

[JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body

[debug] [UiAutomator2] Deleting UiAutomator2 session

[debug] [UiAutomator2] Deleting UiAutomator2 server session

[UiAutomator2] Did not get confirmation UiAutomator2 deleteSession worked; Error was: Error: Trying to proxy a session command without session id
[debug] [ADB] Getting connected devices…
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running ‘/Users/ConnectMacOne/Library/Android/SDK/platform-tools/adb’ with args: ["-P",5037,"-s",“330068990d10a247”,“shell”,“am”,“force-stop”,“com.porsche.connect.r”]

[debug] [Logcat] Stopping logcat capture

[MJSONWP] Encountered internal error running command: ProxyRequestError: Could not proxy command to remote server. Original error: Error: socket hang up
at JWProxy.proxy$ (lib/jsonwp-proxy/proxy.js:122:13)
at tryCatch (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)

Can you try with latest version of [email protected].

this issue is fixed with the last Driver release. I have installed it and i can run my tests without socket hang up.
You can try it by installing appium with the --no-shrinkwrap option:
npm install -g appium --no-shrinkwrap

1 Like

In installed 1.6.3 just last week. Should I still reinstall with the --no-shrinkwrap option? And, if so:

  1. Will it overwrite existing install of 1.6.3?
  2. What does the no-shrinkwrap option do that corrects this?
    Thanks

Hallo @Jennifer_H
The hang up socket issue is already fixed with the last appium release (1.6.3).
You have to install only the last appium version without no-shrinkwrap option.

Hi

I saw this and I got the same error but during the tests itself. So It is running fine and than in the middle of the test it suddenly give the following:

[MJSONWP] Driver proxy active, passing request on via HTTP proxy
[debug] [XCUITest] Executing command ‘proxyReqRes’
[debug] [JSONWP Proxy] Proxying [GET /wd/hub/session/3c3d5df4-d1c2-464e-a823-87f9e503b679/element/9FE9EF7E-2B25-4B45-8C4C-006AD10F04F8/enabled] to [GET http://localhost:8100/session/CD52728A-ACC0-4A21-80BE-BD476885CA5D/element/9FE9EF7E-2B25-4B45-8C4C-006AD10F04F8/enabled] with body: {}
[debug] [iProxy] recv failed: Resource temporarily unavailable
[debug] [iProxy] recv failed: Operation not permitted
[MJSONWP] 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:342:13)
at tryCatch (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
[HTTP] <-- GET /wd/hub/session/3c3d5df4-d1c2-464e-a823-87f9e503b679/element/9FE9EF7E-2B25-4B45-8C4C-006AD10F04F8/enabled 500 953 ms - 280

I have Appium version 1.6.3

Hi @adnen,

I have installed Appium 1.6.3 and trying to run test on Android N by providing automationName uiautomator2. I have installed appium uiautomator2 driver 0.08 as well but didn’t helped.

But I am getting the Socket Hang up:

[MJSONWP] Encountered internal error running command: ProxyRequestError: Could not proxy command to remote server. Original error: Error: socket hang up
at JWProxy.proxy$ (…/…/…/lib/jsonwp-proxy/proxy.js:127:13)
at tryCatch (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
[HTTP] <-- POST /wd/hub/session 500 22209 ms - 216

Hi,
Any update on this issue? I am also facing same issue.