appium / appium-xcuitest-driver

Appium iOS driver, backed by Apple XCTest
https://appium.github.io/appium-xcuitest-driver/
Apache License 2.0
739 stars 416 forks source link

EADDRINUSE ERROR #2470

Closed erdncyz closed 3 days ago

erdncyz commented 1 week ago

Hi Team,

when my automation script is runnning or ı start session with appium inspector. ı encounter EADDRINUSE message.

Appium -v : 2.11.3 appium driver list :

My gist : https://gist.github.com/erdncyz/c707fb88f3eb1c08ae21b7021a50e383

Short error message : [eae8da1f][XCUITestDriver@963f] Using WDA agent: '/Users/techqaautomation2/.appium/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj' [eae8da1f][XCUITestDriver@963f] The pyidevice tool is not present in PATH. Skipping crash logs collection for real devices. [eae8da1f][XCUITestDriver@963f] Event 'logCaptureStarted' logged at 1726310994702 (13:49:54 GMT+0300 (GMT+03:00)) [eae8da1f][XCUITestDriver@963f] Setting up real device [eae8da1f][XCUITestDriver@963f] No obsolete cached processes from previous WDA sessions listening on port 64886 have been found [eae8da1f][DevCon Factory] Requesting connection for device 00008030-000425EC1E04802E on local port 64886, device port 64886 [eae8da1f][DevCon Factory] Cached connections count: 0 [eae8da1f][XCUITestDriver@963f] {"code":"EADDRINUSE","errno":-48,"syscall":"listen","address":"::","port":64886} [eae8da1f][DevCon Factory] Releasing connections for 00008030-000425EC1E04802E device on any port number [eae8da1f][DevCon Factory] No cached connections have been found [eae8da1f][AppiumDriver@ea3e] Event 'newSessionStarted' logged at 1726310994933 (13:49:54 GMT+0300 (GMT+03:00)) [eae8da1f][device-farm-main] 📱 b38e30a0-282e-443e-b59a-45b39e4b3986 Session response: {"protocol":"W3C","error":{"code":"EADDRINUSE","errno":-48,"syscall":"listen","address":"::","port":64886}} [eae8da1f][device-farm-main] 📱 Removing pending session with capability_id: b38e30a0-282e-443e-b59a-45b39e4b3986 [eae8da1f][device-farm-main] b38e30a0-282e-443e-b59a-45b39e4b3986 📱 Device UDID 00008030-000425EC1E04802E unblocked. Reason: Failed to create session [eae8da1f][AppiumDriver@ea3e] Encountered internal error running command: Error: Error: listen EADDRINUSE: address already in use :::64886 at lI.this (/Users/techqaautomation2/.appium/node_modules/appium-device-farm/lib/webpack:/appium-device-farm/lib/src/plugin.js:346:23) at lI.generator (/Users/techqaautomation2/.appium/node_modules/appium-device-farm/lib/webpack:/appium-device-farm/lib/src/plugin.js:332:17) at Generator.next ()

Error screen: image

image

erdncyz commented 3 days ago

Hi @KazuCocoa,

How can fix this issue please help me ?

[ab39c431][XCUITestDriver@f603] {"code":"EADDRINUSE","errno":-48,"syscall":"listen","address":"::","port":64254} [6718092a][XCUITestDriver@3298] {"code":"EADDRINUSE","errno":-48,"syscall":"listen","address":"::","port":64254} [a02beefa][XCUITestDriver@b3b8] {"code":"EADDRINUSE","errno":-48,"syscall":"listen","address":"::","port":64254} [e9c4585b][XCUITestDriver@ff2a] {"code":"EADDRINUSE","errno":-48,"syscall":"listen","address":"::","port":64254} [f88d5b13][XCUITestDriver@dca1] {"code":"EADDRINUSE","errno":-48,"syscall":"listen","address":"::","port":64254} [9299a8af][XCUITestDriver@ae9e] {"code":"EADDRINUSE","errno":-48,"syscall":"listen","address":"::","port":64254} [b3dd7d4c][XCUITestDriver@3185] {"code":"EADDRINUSE","errno":-48,"syscall":"listen","address":"::","port":64254} [66502923][XCUITestDriver@7d7a] {"code":"EADDRINUSE","errno":-48,"syscall":"listen","address":"::","port":64254} [86e0ff27][XCUITestDriver@15e7] {"code":"EADDRINUSE","errno":-48,"syscall":"listen","address":"::","port":64254} [c14cf614][XCUITestDriver@e2a3] {"code":"EADDRINUSE","errno":-48,"syscall":"listen","address":"::","port":64254} [58cc5b2c][XCUITestDriver@8d9a] {"code":"EADDRINUSE","errno":-48,"syscall":"listen","address":"::","port":64254} [751b76da][XCUITestDriver@09bb] {"code":"EADDRINUSE","errno":-48,"syscall":"listen","address":"::","port":64254} [6e7b2f07][XCUITestDriver@f109] {"code":"EADDRINUSE","errno":-48,"syscall":"listen","address":"::","port":64254} [f9211dce][XCUITestDriver@0994] {"code":"EADDRINUSE","errno":-48,"syscall":"listen","address":"::","port":64254}

image
KazuCocoa commented 3 days ago

According to the attached session https://gist.githubusercontent.com/erdncyz/c707fb88f3eb1c08ae21b7021a50e383/raw/acb5fca85ca2abac50c0a5e93985084cadf25668/gistfile1.txt , perhaps the device farmer plugin picked up the already used port 63209 for mjpegServerPort. The link's capabilities also indicated the plugin gave ports to Appium server, so reporting it to the plugin author about possible race condition? of available port selection would help.

[device-farm-main] Waiting for free device. Filter: {"platform":"ios","udid":"00008030-001445A62E6A802E","busy":false,"userBlocked":false}}
[device-farm-main] Updated devices with filter: {"platform":"ios","udid":{"$in":"00008030-001445A62E6A802E"}}
[device-farm-main] Updated devices with filter: {"platform":"ios","udid":{"$in":"00008030-001445A62E6A802E"}}
[device-farm-main] 📱 Blocking device 00008030-001445A62E6A802E at host http://172.28.34.26:4723 for new session
[device-farm-main] Updating allocated device: "{"userBlocked":true,"offline":false,"wdaLocalPort":63208,"mjpegServerPort":63209,"udid":"00008030-001445A62E6A802E","sdk":"16.0.3","name":"iPhone 11 Pro","busy":false,"realDevice":true,"deviceType":"real","platform":"ios","host":"http://172.28.34.26:4723","wdaBundleId":"","productModel":"iPhone12,3","totalUtilizationTimeMilliSec":0,"sessionStartTime":0,"width":"375","height":"812","tags":[],"webDriverAgentUrl":"http://172.28.34.26:63208","nodeId":"815ae7de-ed65-490c-b11b-87458caf16d7","meta":{"revision":1,"created":1724735913793,"version":0,"updated":1724739573386},"$loki":8}"
[device-farm-main] Updated allocated device: "[{"userBlocked":true,"offline":false,"wdaLocalPort":63208,"mjpegServerPort":63209,"udid":"00008030-001445A62E6A802E","sdk":"16.0.3","name":"iPhone 11 Pro","busy":true,"realDevice":true,"deviceType":"real","platform":"ios","host":"http://172.28.34.26:4723","wdaBundleId":"","productModel":"iPhone12,3","totalUtilizationTimeMilliSec":0,"sessionStartTime":0,"width":"375","height":"812","tags":[],"webDriverAgentUrl":"http://172.28.34.26:63208","nodeId":"815ae7de-ed65-490c-b11b-87458caf16d7","meta":{"revision":3,"created":1724735913793,"version":0,"updated":1724739574318},"$loki":8,"newCommandTimeout":120}]"
[device-farm-main] device.host: http://172.28.34.26:4723 and pluginArgs.bindHostOrIp: 172.28.34.26
[device-farm-main] 📱 Creating session on the same node
[device-farm-main] 📱 Forwarding ios port to real device 00008030-001445A62E6A802E for manual interaction
[DevCon Factory Device Farm] Requesting connection for device 00008030-001445A62E6A802E on local port 63209, device port 63209
[DevCon Factory Device Farm] Cached connections count: 0
[AppiumDriver@845b] Command 'createSession' was *not* handled by the following behaviours or plugins, even though they were registered to handle it: ["default"]. The command *was* handled by these: ["device-farm"].
[AppiumDriver@845b] Encountered internal error running command: Error: listen EADDRINUSE: address already in use :::63209
    at Server.setupListenHandle [as _listen2] (node:net:1898:16)
    at listenInCluster (node:net:1946:12)
    at Server.this [as listen] (node:net:2044:7)
    at k.step (/Users/techqaautomation2/.appium/node_modules/appium-device-farm/lib/webpack:/appium-device-farm/lib/src/iProxy.js:71:13)
    at Generator.next (<anonymous>)
    at /Users/techqaautomation2/.appium/node_modules/appium-device-farm/lib/webpack:/appium-device-farm/lib/src/iProxy.js:8:9
    at new Promise (<anonymous>)
    at __awaiter (/Users/techqaautomation2/.appium/node_modules/appium-device-farm/lib/webpack:/appium-device-farm/lib/src/iProxy.js:4:12)
    at k.iproxy (/Users/techqaautomation2/.appium/node_modules/appium-device-farm/lib/webpack:/appium-device-farm/lib/src/iProxy.js:33:16)
    at b.generator (/Users/techqaautomation2/.appium/node_modules/appium-device-farm/lib/webpack:/appium-device-farm/lib/src/iProxy.js:193:27)
    at Generator.next (<anonymous>)
    at S (/Users/techqaautomation2/.appium/node_modules/appium-device-farm/lib/webpack:/appium-device-farm/lib/src/iProxy.js:5:48)
[HTTP] <-- POST /wd/hub/session 500 5 ms - 600 

(Closing as given caps related/3rdparty plugin reason)