Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

capture, move to unhelathy state and exit with 0 error code #847

Closed
vdelendik opened this issue Dec 2, 2023 · 7 comments
Closed

capture, move to unhelathy state and exit with 0 error code #847

vdelendik opened this issue Dec 2, 2023 · 7 comments
Assignees
Milestone

Comments

@vdelendik
Copy link
Contributor

no sense to continue with restarts as device should be reviewed manually. Such kind of errors are potential candidate for hard reset at all.

2023-12-02T12:07:55.442Z INF/device:resources:minicap 35 [2..9] Installing "/opt/node_modules/@devicefarmer/minicap-prebuilt/prebuilt/noarch/minicap.apk" as "/data/local/tmp/minicap.apk"
2023-12-02T12:07:55.731Z INF/device:resources:service 35 [2..9] Checking whether we need to install STFService
2023-12-02T12:07:55.855Z INF/device:resources:service 35 [2..9] Installing STFService
2023-12-02T12:07:57.154Z FTL/device 35 [2..9] Setup had an error Error: /data/local/tmp/STFService.apk could not be installed [INSTALL_FAILED_INSUFFICIENT_STORAGE: Scanning Failed.: Package jp.co.cyberagent.stf could not be assigned a valid UID]
    at /opt/node_modules/@devicefarmer/adbkit/lib/adb/command/host-transport/install.js:28:23
    at processImmediate (node:internal/timers:466:21)
2023-12-02T12:07:57.155Z FTL/util:lifecycle 35 [2..9] Shutting down due to fatal error with optional error :  undefined
2023-12-02T12:07:57.173Z INF/provider 9 [*] Cleaning up device worker "2..9"
2023-12-02T12:07:57.174Z ERR/provider 9 [*] Device worker "2..9" died with code 1
2023-12-02T12:07:57.174Z INF/provider 9 [*] Restarting device worker "2..9"

no space left on device:

panther:/sdcard $ df -H /
Filesystem       Size Used Avail Use% Mounted on
/dev/block/dm-12 864M 862M     0 100% /
@vdelendik vdelendik added this to the 2.6.2 milestone Dec 2, 2023
ignacionar pushed a commit to ignacionar/stf that referenced this issue Dec 4, 2023
vdelendik added a commit that referenced this issue Dec 8, 2023
#847 Capture error, set Unhealthy and exit process
@vdelendik
Copy link
Contributor Author

vdelendik commented Dec 8, 2023

stf:2.6.2-beta1 and mcloud-device:2.6.2-beta1 available for testing.
@dhreben before testing make sure to change in mcloud/.env and mcloud-agent/defaults/main.yml on your own. I didn't push into the ce/mcloud yet

@dhreben
Copy link
Contributor

dhreben commented Dec 12, 2023

Tested on stf:2.6.2-beta1 and mcloud-device:2.6.2-beta1

  1. Disconnect device from linux
  2. Uninstall the STFservice app on device
  3. Full of all the memory on the device
  4. Connect device to linux

Actual result: STFService can't install because there is not enough space with Exit [1] error occurs.
Restarting (1) status in the container is constantly restarting device container every 1 min
Device on STF has status Preparing + disconnected and trying to connect every 1 min

Expected device: Container device has Exit [0] error with unhelthy state on container and STF UI also

Logs:

2023-12-12T09:51:53.725Z INF/device:support:properties 22 [9885e6513238354f31] Loading properties
2023-12-12T09:51:53.791Z INF/device:support:sdk 22 [9885e6513238354f31] Supports SDK 26
2023-12-12T09:51:53.791Z INF/device:support:abi 22 [9885e6513238354f31] Supports ABIs arm64-v8a, armeabi-v7a, armeabi
2023-12-12T09:51:54.103Z INF/device:resources:minicap 22 [9885e6513238354f31] Installing "/opt/node_modules/@devicefarmer/minicap-prebuilt/prebuilt/arm64-v8a/bin/minicap" as "/data/local/tmp/minicap"
2023-12-12T09:51:54.104Z INF/device:resources:minicap 22 [9885e6513238354f31] Installing "/opt/node_modules/@devicefarmer/minicap-prebuilt/prebuilt/arm64-v8a/lib/android-26/minicap.so" as "/data/local/tmp/minicap.so"
2023-12-12T09:51:54.105Z INF/device:resources:minicap 22 [9885e6513238354f31] Installing "/opt/node_modules/@devicefarmer/minicap-prebuilt/prebuilt/noarch/minicap.apk" as "/data/local/tmp/minicap.apk"
2023-12-12T09:51:54.477Z INF/device:resources:service 22 [9885e6513238354f31] Checking whether we need to install STFService
2023-12-12T09:51:55.603Z INF/device:resources:service 22 [9885e6513238354f31] Installing STFService
2023-12-12T09:51:58.344Z FTL/device 22 [9885e6513238354f31] Setup had an error PrematureEOFError: Premature end of stream, needed 1 more bytes
    at Socket.<anonymous> (/opt/node_modules/@devicefarmer/adbkit/lib/adb/parser.js:118:32)
    at Socket.emit (node:events:539:35)
    at endReadableNT (node:internal/streams/readable:1345:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
2023-12-12T09:51:58.345Z FTL/util:lifecycle 22 [9885e6513238354f31] Shutting down due to fatal error with optional error :  undefined
2023-12-12T09:51:58.359Z INF/provider 9 [*] Cleaning up device worker "9885e6513238354f31"
2023-12-12T09:51:58.361Z ERR/provider 9 [*] Device worker "9885e6513238354f31" died with code 1
2023-12-12T09:51:58.362Z FTL/util:lifecycle 9 [*] Shutting down due to fatal error with optional error :  undefined
Exit status: 1

@dhreben dhreben reopened this Dec 12, 2023
ignacionar pushed a commit to ignacionar/stf that referenced this issue Dec 18, 2023
@ignacionar
Copy link
Collaborator

PR: #858

Steps to test:

  1. Clear cookies or test in new incognito window
  2. Fill device memory, uninstall STFService
  3. Try to install it again when plugged as new

dhreben added a commit that referenced this issue Dec 20, 2023
#847 exit 0 code and small delay to change status
@dhreben
Copy link
Contributor

dhreben commented Dec 22, 2023

Tested on stf:2.6.2-beta5 and mcloud-device:2.6.2-beta5

  1. Disconnect device from linux
  2. Uninstall the STFservice app on device
  3. Full of all the memory on the device
  4. Connect device to linux

Actual result: Device status has disconnected status on STF
Expected result: Device status has unhealthy status on STF

dhreben added a commit that referenced this issue Dec 26, 2023
#847 Fix for displaying Unhealthy status correctly in Android
@dhreben
Copy link
Contributor

dhreben commented Dec 27, 2023

Tested on stf:2.6.2-beta9 and mcloud-device:2.6.2-beta9

Still repro with STF UI status
Android device has disconnected status

Screenshot 2023-12-27 at 22 50 14

logs from container

2023-12-27T19:34:26.921Z INF/device:plugins:screen:stream 21 [LGH8........1fc7] minicap says: "INFO: (external/MY_minicap/src/minicap_26.cpp:276) Publishing virtual display"
2023-12-27T19:34:26.926Z INF/device:plugins:screen:stream 21 [LGH...........1fc7] minicap says: "INFO: (jni/minicap/JpgEncoder.cpp:64) Allocating 12443652 bytes for JPG encoder"
2023-12-27T19:34:27.029Z INF/device:plugins:screen:stream 21 [LGH.............fc7] Reading minicap banner
2023-12-27T19:34:27.040Z INF/device:plugins:screen:stream 21 [LGH8.............c7] minicap says: "INFO: (jni/minicap/minicap.cpp:464) New client connection"
2023-12-27T19:39:45.402Z IMP/device:plugins:service 21 [LGH.............c7] Service connection ended, attempting to relaunch
2023-12-27T19:39:45.402Z INF/device:plugins:service 21 [LGH8............c7] Launching service
2023-12-27T19:39:45.402Z INF/device:plugins:service 21 [LGH............fc7] using 'start-foreground-service' command for API 26
2023-12-27T19:39:46.157Z FTL/device:plugins:service 21 [LGH87..............c7] Service connection could not be relaunched Error: Service had an error: "Error: Not found; no service started."
    at /opt/lib/units/device/plugins/service.js:104:23
From previous event:
    at /opt/lib/units/device/plugins/service.js:79:14
    at processImmediate (node:internal/timers:466:21)
2023-12-27T19:39:46.157Z FTL/util:lifecycle 21 [LG.............1fc7] Shutting down due to fatal error with optional error :  undefined
2023-12-27T19:39:46.178Z INF/provider 8 [*] Cleaning up device worker "LGH..............1fc7"
2023-12-27T19:39:46.179Z ERR/provider 8 [*] Device worker "LGH..........1fc7" died with code 1
2023-12-27T19:39:46.180Z INF/util:lifecycle 8 [*] Winding down for graceful exit, with optional error :  ExitError: Exit code "1"
    at ChildProcess.exitListener (/opt/lib/units/provider/index.js:204:29)
    at ChildProcess.emit (node:events:527:28)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12) {
  code: 1
}
Warning: .then() only accepts functions but was passed: [object Object]
    at /opt/lib/units/provider/index.js:301:42
    at processImmediate (node:internal/timers:466:21)
From previous event:
    at Timeout.work [as _onTimeout] (/opt/lib/units/provider/index.js:285:17)
    at listOnTimeout (node:internal/timers:559:17)
    at processTimers (node:internal/timers:502:7)
Unhandled rejection ExitError: Exit code "1"
    at ChildProcess.exitListener (/opt/lib/units/provider/index.js:204:29)
    at ChildProcess.emit (node:events:527:28)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
2023-12-27T19:39:46.186Z WRN/db 8 [*] Connection closed
Exit status: 0

@dhreben
Copy link
Contributor

dhreben commented Dec 27, 2023

Retested with clear cache and cookies

Screenshot 2023-12-28 at 00 06 41

@dhreben dhreben closed this as completed Dec 27, 2023
@dhreben
Copy link
Contributor

dhreben commented Dec 27, 2023

Verified

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

3 participants