Skip to content

WebSocket connection failed #854

@csdaa

Description

@csdaa

What is the issue or idea you have?

After restarting the server every week and reconnecting the phones, there are always 2 to 3 phones that cannot be controlled, with the message 'WebSocket connection failed' seen from the Chrome dev tools.

Does it only happen on a specific device? Please run adb devices -l and paste the corresponding row.
I connected 15 mobile phones....It is not a specific device, but rather randomness.

adb devices -l
List of devices attached
R5CW30TQ57K            device product:a54xzc model:SM_A5460 device:a54x transport_id:3

Please provide the steps to reproduce the issue.

  1. Execute the command 'adb nodaemon server -a -P 5037' on the client.
  2. Execute the command: 'stf provider --name "R" --min-port 7800 --max-port 7810 --connect-sub tcp://127.0.0.1:7114 --connect-push tcp://127.0.0.1:7116 --group-timeout 900 --public-ip 192.168.58.200 --storage-url http://localhost:7100/ --adb-host 192.168.145.171 --adb-port 5037 --vnc-initial-size 600*800 --mute-master never --allow-remote' on the server.
  3. Click the device control button in the browser.

What is the expected behavior?
The device can output images.

Do you see errors or warnings in the stf local output? If so, please paste them or the full log here.

2025-05-16T12:19:18.559Z INF/provider 1583 [*] Subscribing to permanent channel "J1tk1a/lQtqVF4tcDpGiaw=="
2025-05-16T12:19:18.561Z INF/provider 1583 [*] Sending output to "tcp://127.0.0.1:7116"
2025-05-16T12:19:18.562Z INF/provider 1583 [*] Receiving input from "tcp://127.0.0.1:7114"
2025-05-16T12:19:18.566Z INF/provider 1583 [*] Tracking devices
2025-05-16T12:19:18.568Z INF/provider 1583 [*] Found device "R5CW30TQ57K" (device)
2025-05-16T12:19:18.580Z INF/provider 1583 [*] Registered device "R5CW30TQ57K"
2025-05-16T12:19:18.816Z INF/device:support:push 1592 [R5CW30TQ57K] Sending output to "tcp://127.0.0.1:7116"
2025-05-16T12:19:18.818Z INF/device 1592 [R5CW30TQ57K] Preparing device
2025-05-16T12:19:18.979Z INF/device:support:sub 1592 [R5CW30TQ57K] Receiving input from "tcp://127.0.0.1:7114"
2025-05-16T12:19:18.980Z INF/device:support:sub 1592 [R5CW30TQ57K] Subscribing to permanent channel "*ALL"
2025-05-16T12:19:19.052Z INF/device:support:properties 1592 [R5CW30TQ57K] Loading properties
2025-05-16T12:19:19.134Z INF/device:support:sdk 1592 [R5CW30TQ57K] Supports SDK 34
2025-05-16T12:19:19.135Z INF/device:support:abi 1592 [R5CW30TQ57K] Supports ABIs arm64-v8a, armeabi-v7a, armeabi
2025-05-16T12:19:19.442Z INF/device:resources:minicap 1592 [R5CW30TQ57K] Installing "/app/node_modules/@devicefarmer/minicap-prebuilt/prebuilt/noarch/minicap.apk" as "/data/local/tmp/minicap.apk"
2025-05-16T12:19:19.702Z INF/device:resources:service 1592 [R5CW30TQ57K] Checking whether we need to install STFService
2025-05-16T12:19:19.716Z INF/device:resources:service 1592 [R5CW30TQ57K] ----getPath---1---
2025-05-16T12:19:19.764Z INF/device:resources:service 1592 [R5CW30TQ57K] ----getPath---2--line:package:/data/app/~~3-urYgqHLzc8vpx8W2xYDg==/jp.co.cyberagent.stf-lY1GscSCDhfe0TCnNuubWw==/base.apk
----getPath---2--line:package:/data/app/~~3-urYgqHLzc8vpx8W2xYDg==/jp.co.cyberagent.stf-lY1GscSCDhfe0TCnNuubWw==/base.apk
2025-05-16T12:19:19.765Z INF/device:resources:service 1592 [R5CW30TQ57K] Running version check
2025-05-16T12:19:20.902Z INF/device:resources:service 1592 [R5CW30TQ57K] ----skip version check----version:2.4.12

2025-05-16T12:19:20.904Z INF/device:resources:service 1592 [R5CW30TQ57K] STFService up to date
2025-05-16T12:19:20.905Z INF/device:plugins:service 1592 [R5CW30TQ57K] Launching agent
2025-05-16T12:19:21.512Z INF/device:plugins:service 1592 [R5CW30TQ57K] Agent says: "Starting minitouch agent"
2025-05-16T12:19:21.539Z INF/device:plugins:service 1592 [R5CW30TQ57K] Agent says: "Listening on @stfagent"
2025-05-16T12:19:21.557Z INF/device:plugins:service 1592 [R5CW30TQ57K] Launching service
2025-05-16T12:19:21.558Z INF/device:plugins:service 1592 [R5CW30TQ57K] using 'start-foreground-service' command for API 34
------callService----adb--shell:am start-foreground-service --user 0 -a 'jp.co.cyberagent.stf.ACTION_START' -n 'jp.co.cyberagent.stf/.Service'
2025-05-16T12:19:21.560Z INF/device:plugins:service 1592 [R5CW30TQ57K] Agent says: "InputClient started"
2025-05-16T12:19:21.638Z INF/device:plugins:display 1592 [R5CW30TQ57K] Reading display info
2025-05-16T12:19:21.685Z INF/device:plugins:phone 1592 [R5CW30TQ57K] Fetching phone info
2025-05-16T12:19:21.699Z INF/device:plugins:identity 1592 [R5CW30TQ57K] Solving identity
2025-05-16T12:19:21.704Z INF/device:plugins:solo 1592 [R5CW30TQ57K] Subscribing to permanent channel "o73UHrmnhkgk/4PZrJwr+aL1Ges="
2025-05-16T12:19:21.705Z INF/device:plugins:screen:stream 1592 [R5CW30TQ57K] ScreenGrabber option set to minicap-bin
2025-05-16T12:19:21.706Z INF/device:plugins:screen:stream 1592 [R5CW30TQ57K] ScreenFrameRate option set to -1
2025-05-16T12:19:21.707Z INF/device:plugins:screen:stream 1592 [R5CW30TQ57K] Starting WebSocket server on port 7400
2025-05-16T12:19:21.712Z FTL/device 1592 [R5CW30TQ57K] Setup had an error Error: listen EADDRINUSE: address already in use :::7400
    at Server.setupListenHandle [as _listen2] (node:net:1380:16)
    at listenInCluster (node:net:1428:12)
    at Server.listen (node:net:1516:7)
    at new WebSocketServer (/app/node_modules/ws/lib/WebSocketServer.js:76:20)
    at createServer (/app/lib/units/device/plugins/screen/stream.js:445:17)
From previous event:
    at createServer (/app/lib/units/device/plugins/screen/stream.js:451:14)
    at /app/lib/units/device/plugins/screen/stream.js:469:12
    at SerialSyrup.ParallelSyrup.invoke (/app/node_modules/@devicefarmer/stf-syrup/lib/parallel.js:54:24)
    at /app/node_modules/@devicefarmer/stf-syrup/lib/serial.js:43:33
    at processTicksAndRejections (node:internal/process/task_queues:78:11)
2025-05-16T12:19:21.713Z FTL/util:lifecycle 1592 [R5CW30TQ57K] Shutting down due to fatal error
2025-05-16T12:19:21.721Z INF/provider 1583 [*] Cleaning up device worker "R5CW30TQ57K"
2025-05-16T12:19:21.722Z ERR/provider 1583 [*] Device worker "R5CW30TQ57K" died with code 1
2025-05-16T12:19:21.722Z INF/provider 1583 [*] Restarting device worker "R5CW30TQ57K"
2025-05-16T12:19:22.351Z INF/device:support:push 1605 [R5CW30TQ57K] Sending output to "tcp://127.0.0.1:7116"
2025-05-16T12:19:22.353Z INF/device 1605 [R5CW30TQ57K] Preparing device
2025-05-16T12:19:22.514Z INF/device:support:sub 1605 [R5CW30TQ57K] Receiving input from "tcp://127.0.0.1:7114"
2025-05-16T12:19:22.515Z INF/device:support:sub 1605 [R5CW30TQ57K] Subscribing to permanent channel "*ALL"
2025-05-16T12:19:22.591Z INF/device:support:properties 1605 [R5CW30TQ57K] Loading properties
2025-05-16T12:19:22.674Z INF/device:support:sdk 1605 [R5CW30TQ57K] Supports SDK 34
2025-05-16T12:19:22.675Z INF/device:support:abi 1605 [R5CW30TQ57K] Supports ABIs arm64-v8a, armeabi-v7a, armeabi
2025-05-16T12:19:22.928Z INF/device:resources:minicap 1605 [R5CW30TQ57K] Installing "/app/node_modules/@devicefarmer/minicap-prebuilt/prebuilt/noarch/minicap.apk" as "/data/local/tmp/minicap.apk"
2025-05-16T12:19:23.185Z INF/device:resources:service 1605 [R5CW30TQ57K] Checking whether we need to install STFService
2025-05-16T12:19:23.203Z INF/device:resources:service 1605 [R5CW30TQ57K] ----getPath---1---
2025-05-16T12:19:23.259Z INF/device:resources:service 1605 [R5CW30TQ57K] ----getPath---2--line:package:/data/app/~~3-urYgqHLzc8vpx8W2xYDg==/jp.co.cyberagent.stf-lY1GscSCDhfe0TCnNuubWw==/base.apk
----getPath---2--line:package:/data/app/~~3-urYgqHLzc8vpx8W2xYDg==/jp.co.cyberagent.stf-lY1GscSCDhfe0TCnNuubWw==/base.apk
2025-05-16T12:19:23.260Z INF/device:resources:service 1605 [R5CW30TQ57K] Running version check

2025-05-16T12:21:04.762Z WRN/device:plugins:data 1969 [R5CW30TQ57K] Unable to find device data {
  serial: 'R5CW30TQ57K',
  platform: 'Android',
  manufacturer: 'SAMSUNG',
  operator: ',',
  model: 'SM-A5460',
  version: '14',
  abi: 'arm64-v8a',
  sdk: '34',
  product: 'a54xzc',
  cpuPlatform: 'erd8835',
  openGLESVersion: '3.2',
  marketName: 'Galaxy A54 5G',
  display: {
    id: 0,
    width: 1080,
    height: 2340,
    xdpi: 403.4110107421875,
    ydpi: 401.593994140625,
    fps: 60,
    density: 2.8125,
    rotation: 0,
    secure: true,
    size: 6.412379476761468,
    url: 'ws://192.168.58.200:7516'
  },
  phone: [Object: null prototype] { network: 'UNKNOWN' }
}
2025-05-16T12:21:04.767Z INF/device:plugins:touch 1969 [R5CW30TQ57K] Touch origin is top left
2025-05-16T12:21:04.768Z INF/device:plugins:touch 1969 [R5CW30TQ57K] Requesting touch consumer to start
2025-05-16T12:21:04.769Z INF/device:plugins:touch 1969 [R5CW30TQ57K] Launching touch service
2025-05-16T12:21:04.790Z INF/device:plugins:touch 1969 [R5CW30TQ57K] Connecting to minitouch service
2025-05-16T12:21:04.831Z INF/device:plugins:touch 1969 [R5CW30TQ57K] minitouch says: "open: Permission denied"
2025-05-16T12:21:04.831Z INF/device:plugins:touch 1969 [R5CW30TQ57K] minitouch says: "Unable to open device /dev/input/event2 for inspectionopen: Permission denied"
2025-05-16T12:21:04.832Z INF/device:plugins:touch 1969 [R5CW30TQ57K] minitouch says: "Unable to open device /dev/input/event8 for inspectionopen: Permission denied"
2025-05-16T12:21:04.833Z INF/device:plugins:touch 1969 [R5CW30TQ57K] minitouch says: "Unable to open device /dev/input/event6 for inspectionopen: Permission denied"
2025-05-16T12:21:04.834Z INF/device:plugins:touch 1969 [R5CW30TQ57K] minitouch says: "Unable to open device /dev/input/event0 for inspectionopen: Permission denied"
2025-05-16T12:21:04.835Z INF/device:plugins:touch 1969 [R5CW30TQ57K] minitouch says: "Unable to open device /dev/input/event9 for inspectionopen: Permission denied"
2025-05-16T12:21:04.835Z INF/device:plugins:touch 1969 [R5CW30TQ57K] minitouch says: "Unable to open device /dev/input/event3 for inspectionopen: Permission denied"
2025-05-16T12:21:04.836Z INF/device:plugins:touch 1969 [R5CW30TQ57K] minitouch says: "Unable to open device /dev/input/event7 for inspectionopen: Permission denied"
2025-05-16T12:21:04.837Z INF/device:plugins:touch 1969 [R5CW30TQ57K] minitouch says: "Unable to open device /dev/input/event5 for inspectionopen: Permission denied"
2025-05-16T12:21:04.838Z INF/device:plugins:touch 1969 [R5CW30TQ57K] minitouch says: "Unable to open device /dev/input/event4 for inspectionopen: Permission denied"
2025-05-16T12:21:04.839Z INF/device:plugins:touch 1969 [R5CW30TQ57K] minitouch says: "Unable to open device /dev/input/event1 for inspectionUnable to find a suitable touch device"
2025-05-16T12:21:04.839Z INF/device:plugins:touch 1969 [R5CW30TQ57K] minitouch says: "using Android InputManager"
2025-05-16T12:21:04.909Z INF/device:plugins:touch 1969 [R5CW30TQ57K] Reading minitouch banner
2025-05-16T12:21:04.910Z INF/device:plugins:touch 1969 [R5CW30TQ57K] minitouch says: "Connection established"
2025-05-16T12:21:04.954Z INF/device:plugins:vnc 1969 [R5CW30TQ57K] Starting VNC server on port 7518
2025-05-16T12:21:04.960Z INF/device:plugins:browser 1969 [R5CW30TQ57K] Loading browser list
2025-05-16T12:21:04.979Z INF/device:plugins:browser 1969 [R5CW30TQ57K] Updating browser list
2025-05-16T12:21:04.980Z WRN/device:plugins:browser 1969 [R5CW30TQ57K] Unmapped browser "com.UCMobile"
2025-05-16T12:21:04.980Z WRN/device:plugins:browser 1969 [R5CW30TQ57K] Unmapped browser "com.UCMobile"
2025-05-16T12:21:04.981Z WRN/device:plugins:browser 1969 [R5CW30TQ57K] Unmapped browser "com.baidu.searchbox"
2025-05-16T12:21:04.982Z WRN/device:plugins:browser 1969 [R5CW30TQ57K] Unmapped browser "com.mobile.cloudgames"
2025-05-16T12:21:04.982Z WRN/device:plugins:browser 1969 [R5CW30TQ57K] Unmapped browser "com.samsung.android.app.searchwidget"
2025-05-16T12:21:04.983Z WRN/device:plugins:browser 1969 [R5CW30TQ57K] Unmapped browser "com.tencent.mtt"
2025-05-16T12:21:04.983Z WRN/device:plugins:browser 1969 [R5CW30TQ57K] Unmapped browser "com.samsung.android.bixbyhelper"
2025-05-16T12:21:04.986Z INF/device:plugins:mute 1969 [R5CW30TQ57K] Will not mute master volume
2025-05-16T12:21:05.305Z INF/device:resources:minirev 1969 [R5CW30TQ57K] Installing "/app/vendor/minirev/arm64-v8a/minirev" as "/data/local/tmp/minirev"
2025-05-16T12:21:05.385Z INF/device:plugins:forward 1969 [R5CW30TQ57K] Launching reverse port forwarding service
2025-05-16T12:21:05.400Z INF/device:plugins:forward 1969 [R5CW30TQ57K] Connecting to reverse port forwarding service
2025-05-16T12:21:05.603Z INF/device 1969 [R5CW30TQ57K] Fully operational

Image

Please run stf doctor and paste the output here.
2025-05-16T12:28:23.116Z INF/cli:doctor 1994 [] OS Arch: x64
2025-05-16T12:28:23.116Z INF/cli:doctor 1994 [
] OS Platform: linux
2025-05-16T12:28:23.117Z INF/cli:doctor 1994 [] OS Platform: 3.10.0-1160.el7.x86_64
2025-05-16T12:28:23.117Z INF/cli:doctor 1994 [
] Using Node 17.9.0
2025-05-16T12:28:23.122Z INF/cli:doctor 1994 [] Using ZeroMQ 4.2.2
2025-05-16T12:28:23.129Z ERR/cli:doctor 1994 [
] RethinkDB is not installed (rethinkdb is missing)
2025-05-16T12:28:23.129Z ERR/cli:doctor 1994 [] ProtoBuf is not installed (protoc is missing)
2025-05-16T12:28:23.129Z ERR/cli:doctor 1994 [
] ADB is not installed (adb is missing)
2025-05-16T12:28:23.129Z INF/cli:doctor 1994 [*] Using GraphicsMagick 1.3.35

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions