DeviceFarmer / stf

Control and manage Android devices from your browser.
https://devicefarmer.github.io
Other
3.32k stars 479 forks source link

aosp Android 9 stuck in preparation #807

Open chengdada123 opened 5 days ago

chengdada123 commented 5 days ago

What is the issue or idea you have? aosp Android 9 stuck in infinite loop in preparation Does it only happen on a specific device? Please run adb devices -l and paste the corresponding row.

List of devices attached 127.0.0.1:1235 device

Please provide the steps to reproduce the issue.

After stf is started, connect the device

What is the expected behavior?

Expected to display and operate the device normally

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

2024-09-13T05:49:29.613Z INF/device:resources:service 119603 [127.0.0.1:1235] Checking whether we need to install STFService 2024-09-13T05:49:29.691Z INF/device:resources:service 119603 [127.0.0.1:1235] Running version check 2024-09-13T05:49:29.937Z DBG/device:resources:service 119603 [127.0.0.1:1235] SDK version (28) is lower than 31, permission android.permission.BLUETOOTH_CONNECT not supported 2024-09-13T05:49:29.938Z DBG/device:resources:service 119603 [127.0.0.1:1235] Granting permission to STFService: android.permission.SYSTEM_ALERT_WINDOW 2024-09-13T05:49:30.019Z DBG/device:resources:service 119603 [127.0.0.1:1235] Permission granted android.permission.SYSTEM_ALERT_WINDOW 2024-09-13T05:49:30.020Z INF/device:resources:service 119603 [127.0.0.1:1235] STFService up to date 2024-09-13T05:49:30.022Z INF/device:plugins:service 119603 [127.0.0.1:1235] Launching agent 2024-09-13T05:49:30.412Z INF/device:plugins:service 119603 [127.0.0.1:1235] Agent says: "Starting minitouch agent" 2024-09-13T05:49:30.492Z INF/device:plugins:service 119603 [127.0.0.1:1235] Agent says: "Listening on @stfagent" 2024-09-13T05:49:30.515Z INF/device:plugins:service 119603 [127.0.0.1:1235] Launching service 2024-09-13T05:49:30.516Z INF/device:plugins:service 119603 [127.0.0.1:1235] using 'start-foreground-service' command for API 28 2024-09-13T05:49:30.540Z INF/device:plugins:service 119603 [127.0.0.1:1235] Agent says: "InputClient started" 2024-09-13T05:49:30.586Z FTL/device 119603 [127.0.0.1:1235] Setup had an error Error: Service had an error: "Error: Not found; no service started." at /root/stf/lib/units/device/plugins/service.js:104:23 From previous event: at /root/stf/lib/units/device/plugins/service.js:79:14 at process.processImmediate (node:internal/timers:483:21) 2024-09-13T05:49:30.587Z FTL/util:lifecycle 119603 [127.0.0.1:1235] Shutting down due to fatal error 2024-09-13T05:49:30.597Z INF/provider 115903 [] Cleaning up device worker "127.0.0.1:1235" 2024-09-13T05:49:30.597Z ERR/provider 115903 [] Device worker "127.0.0.1:1235" died with code 1 2024-09-13T05:49:30.598Z INF/provider 115903 [] Restarting device worker "127.0.0.1:1235" 2024-09-13T05:49:31.306Z INF/device:support:push 119616 [127.0.0.1:1235] Sending output to "tcp://127.0.0.1:7116" 2024-09-13T05:49:31.309Z INF/device 119616 [127.0.0.1:1235] Preparing device 2024-09-13T05:49:31.654Z INF/device:support:sub 119616 [127.0.0.1:1235] Receiving input from "tcp://127.0.0.1:7114" 2024-09-13T05:49:31.656Z INF/device:support:sub 119616 [127.0.0.1:1235] Subscribing to permanent channel "ALL" 2024-09-13T05:49:31.732Z INF/device:support:properties 119616 [127.0.0.1:1235] Loading properties 2024-09-13T05:49:31.787Z INF/device:support:sdk 119616 [127.0.0.1:1235] Supports SDK 28 2024-09-13T05:49:31.788Z INF/device:support:abi 119616 [127.0.0.1:1235] Supports ABIs arm64-v8a, armeabi-v7a, armeabi 2024-09-13T05:49:31.873Z INF/device:resources:minicap 119616 [127.0.0.1:1235] Installing "/root/stf/node_modules/@devicefarmer/minicap-prebuilt/prebuilt/arm64-v8a/bin/minicap" as "/data/local/tmp/minicap" 2024-09-13T05:49:31.874Z INF/device:resources:minicap 119616 [127.0.0.1:1235] Installing "/root/stf/node_modules/@devicefarmer/minicap-prebuilt/prebuilt/arm64-v8a/lib/android-28/minicap.so" as "/data/local/tmp/minicap.so" 2024-09-13T05:49:31.875Z INF/device:resources:minicap 119616 [127.0.0.1:1235] Installing "/root/stf/node_modules/@devicefarmer/minicap-prebuilt/prebuilt/noarch/minicap.apk" as "/data/local/tmp/minicap.apk" 2024-09-13T05:49:33.605Z INF/device:resources:service 119616 [127.0.0.1:1235] Checking whether we need to install STFService

Please run stf doctor and paste the output here.

2024-09-13T05:52:14.040Z INF/cli:doctor 119714 [] OS Arch: x64 2024-09-13T05:52:14.042Z INF/cli:doctor 119714 [] OS Platform: linux 2024-09-13T05:52:14.042Z INF/cli:doctor 119714 [] OS Platform: 5.15.0-91-generic 2024-09-13T05:52:14.043Z INF/cli:doctor 119714 [] Using Node 20.17.0 2024-09-13T05:52:14.053Z INF/cli:doctor 119714 [] Using ZeroMQ 4.2.2 2024-09-13T05:52:14.071Z INF/cli:doctor 119714 [] Using GraphicsMagick 1.3.35 2024-09-13T05:52:14.073Z INF/cli:doctor 119714 [] Using ADB 1.0.39 2024-09-13T05:52:14.074Z INF/cli:doctor 119714 [] Using ProtoBuf 3.6.1 2024-09-13T05:52:14.075Z INF/cli:doctor 119714 [*] Using RethinkDB 2.4.4~0focal

denis99999 commented 4 days ago

@chengdada123 , please provide your launching command ? Do you meet the same error with any devices ? How do you get 127.0.0.1:1235 serial for the device ? Can you explain you developing environment ?

chengdada123 commented 4 days ago

My startup command is: stf local --public-ip 8.13.X.X --allow-remote I used the ssh command to map the remote cloud phone to the local port 1235, and then connected with adb. Thank you

denis99999 commented 4 days ago

@chengdada123 , ST has been tested with SDK from 19 to 34, so I think your problem comes from your remote device, please answer to these questions:

chengdada123 commented 4 days ago

Do you get the same error when using any device? Currently I only have a cloud phone for testing Do you get the same error when using a real local device? I don't have a local device, and stf is also running on the server Is your remote device an emulator? Yes, it is a cloud virtual machine Who is your cloud device provider? Huawei Cloud Phone Server What command do you use to remotely connect to your device? Actually it is also an adb command Have you tried running adb connect.. command instead of ssh mapping? adb connect 127.0.0.1:1234

Please refer to: https://support.huaweicloud.com/bestpractice-cph/cph_bp_0017.html

https://support.huaweicloud.com/usermanual-cph/cph_ug_0010.html

denis99999 commented 4 days ago

@chengdada123 , STF is designed for real Android devices, it doesn't fully support emulators, and I also see that CPH provides a special version of ADB that translates the command into RestFul API calls, I think that's why this doesn't doesn't work, sorry!

chengdada123 commented 4 days ago

How to find this CPH provides a special version of ADB Thanks

chengdada123 commented 4 days ago

airtest supports displaying pages but cannot manage multiple phones at the same time: https://support.huaweicloud.com/bestpractice-cph/cph_bp_0001.html I think something went wrong. Maybe minicap? According to CPH's practical tutorial and screenshots, it is possible to connect via STF. Please help me. Thank you very much!

denis99999 commented 4 days ago

How to find this CPH provides a special version of ADB

https://support.huaweicloud.com/intl/en-us/cph_faq/cph_faq_0032.html

https://support.huaweicloud.com/bestpractice-cph/cph_bp_0001.html

please send me link in english?

denis99999 commented 4 days ago

@chengdada123 , set this variable before running STF: STF_PROVIDER_SCREEN_GRABBER=minicap-apk, and let me know if it fix your issue?

chengdada123 commented 4 days ago

@chengdada123 , set this variable before running STF: STF_PROVIDER_SCREEN_GRABBER=minicap-apk, and let me know if it fix your issue?

The variable is set, but the problem still exists

denis99999 commented 4 days ago

please speak in english only!

chengdada123 commented 4 days ago

How to find this CPH provides a special version of ADB

https://support.huaweicloud.com/intl/en-us/cph_faq/cph_faq_0032.html

https://support.huaweicloud.com/bestpractice-cph/cph_bp_0001.html

please send me link in english?

https://support.huaweicloud.com/intl/en-us/bestpractice-cph/cph_bp_0017.html

chengdada123 commented 4 days ago

please speak in english only!

OK !Thank you very much for your reply!

denis99999 commented 4 days ago

@chengdada123 , you are right, CPH says it can interface with STF, it also seems like you said an SSH tunnel needs to be established before using ADB, only try to interact with the phone without STF , for example: adb shell ls, does it work?

chengdada123 commented 4 days ago

@chengdada123 , you are right, CPH says it can interface with STF, it also seems like you said an SSH tunnel needs to be established before using ADB, only try to interact with the phone without STF , for example: adb shell ls, does it work?

Yes, similar to adb shell ls, it works normally

denis99999 commented 4 days ago

@chengdada123 , I am testing it!

chengdada123 commented 4 days ago

@chengdada123 , I am testing it!

If you have any problems with adb connection, please let me know

denis99999 commented 4 days ago

@chengdada123 , I solved your problem temporarily, you need to replace lib/units/device/plugins/service.js by the attached file service.zip, after that the phone is well installed and viewable on STF UI I will make a PR later, but for that I will still need your cloud phone to test, contact me privately for that!

chengdada123 commented 4 days ago

@chengdada123 , I solved your problem temporarily, you need to replace lib/units/device/plugins/service.js by the attached file service.zip, after that the phone is well installed and viewable on STF UI I will make a PR later, but for that I will still need your cloud phone to test, contact me privately for that!

OK, thank you for your hard work. The test machine will be kept for you 24 hours. If you have any questions, please contact me. Thank you

denis99999 commented 4 days ago

@chengdada123 , you have to test it on your side, now I'm going home for the weekend ;-)

chengdada123 commented 4 days ago

After I replaced the file, he can access and control it. No problems have been found so far. Thank you for your help and have a nice weekend!

chengdada123 commented 3 days ago

A new problem has occurred. When the number of devices exceeds 75, the remaining devices are stuck in preparation. Please confirm whether this is a bug or a limitation of the system.

denis99999 commented 2 days ago

@chengdada123 , this is neither a bug nor a limitation, it is your STF configuration which determines this limitation, in fact by default STF is launched to manage 75 devices maximum, in local mode this limit is controlled by the options --provider-min-port and --provider-max-port (get help like this => stf local --help) with default values ​​of 7400 and 7700 respectively, knowing that a device requires 4 ports => (7700 - 7400) / 4 = 75 devices, so you just need to enlarge the corresponding interval according to your needs, for example: stf local --provider-min-port 7400 --provider-max-port 8000 ... enabling 150 devices

chengdada123 commented 1 day ago

QQ截图20240916172604

During the operation, I will be redirected to this page from time to time. Can this be avoided?

denis99999 commented 1 day ago

@chengdada123 , no, not with the patch that I provided you, but just return to the home page to make this screen disappear

chengdada123 commented 1 day ago

Yes, it is not the patch you modified. The problem is that this page appears again a few seconds after I return to the home page.

denis99999 commented 1 day ago

Can you give me the control of the device ?

chengdada123 commented 1 day ago

2024-09-16T14:29:38.744Z INF/device:plugins:screen:stream 141759 [127.0.0.1:1235] Requesting frame producer to stop 2024-09-16T14:29:38.745Z INF/device:plugins:screen:stream 141759 [127.0.0.1:1235] Disconnecting from minicap service 2024-09-16T14:29:38.747Z INF/device:plugins:screen:stream 141759 [127.0.0.1:1235] Stopping minicap service 2024-09-16T14:29:38.748Z INF/device:plugins:screen:stream 141759 [127.0.0.1:1235] Sending SIGTERM to minicap 2024-09-16T14:29:38.887Z INF/device:plugins:screen:stream 141759 [127.0.0.1:1235] Keeping 502x677 as current frame producer projection 2024-09-16T14:29:38.888Z INF/device:plugins:screen:stream 141759 [127.0.0.1:1235] Requesting frame producer to start 2024-09-16T14:29:39.163Z INF/device:plugins:screen:stream 141759 [127.0.0.1:1235] minicap says: "INFO: (jni/minicap/minicap.cpp:200) Received SIGTERM, stopping" 2024-09-16T14:29:39.164Z INF/device:plugins:screen:stream 141759 [127.0.0.1:1235] minicap says: "INFO: (jni/minicap/minicap.cpp:536) Closing client connection" 2024-09-16T14:29:39.164Z INF/device:plugins:screen:stream 141759 [127.0.0.1:1235] minicap says: "INFO: (external/MY_minicap/src/minicap_28.cpp:291) Destroying virtual display" 2024-09-16T14:29:39.168Z INF/device:plugins:screen:stream 141759 [127.0.0.1:1235] Launching screen service minicap-bin 2024-09-16T14:29:39.169Z INF/device:resources:minicap 141759 [127.0.0.1:1235] LD_LIBRARY_PATH=/data/local/tmp exec /data/local/tmp/minicap -S -Q 80 -P 720x1280@502x677/0 2024-09-16T14:29:39.653Z INF/device:plugins:screen:stream 141759 [127.0.0.1:1235] minicap says: "PID: 1598" 2024-09-16T14:29:39.654Z INF/device:plugins:screen:stream 141759 [127.0.0.1:1235] minicap says: "INFO: Using projection 720x1280@381x677/0" 2024-09-16T14:29:39.656Z INF/device:plugins:screen:stream 141759 [127.0.0.1:1235] minicap says: "INFO: (external/MY_minicap/src/minicap_28.cpp:241) Creating SurfaceComposerClient" 2024-09-16T14:29:39.658Z INF/device:plugins:screen:stream 141759 [127.0.0.1:1235] Connecting to minicap service 2024-09-16T14:29:40.065Z INF/device:plugins:screen:stream 141759 [127.0.0.1:1235] minicap says: "INFO: (external/MY_minicap/src/minicap_28.cpp:244) Performing SurfaceComposerClient init check" 2024-09-16T14:29:40.066Z INF/device:plugins:screen:stream 141759 [127.0.0.1:1235] minicap says: "INFO: (external/MY_minicap/src/minicap_28.cpp:255) Creating virtual display" 2024-09-16T14:29:40.067Z INF/device:plugins:screen:stream 141759 [127.0.0.1:1235] minicap says: "INFO: (external/MY_minicap/src/minicap_28.cpp:261) Creating buffer queue" 2024-09-16T14:29:40.067Z INF/device:plugins:screen:stream 141759 [127.0.0.1:1235] minicap says: "INFO: (external/MY_minicap/src/minicap_28.cpp:264) Setting buffer options" 2024-09-16T14:29:40.068Z INF/device:plugins:screen:stream 141759 [127.0.0.1:1235] minicap says: "INFO: (external/MY_minicap/src/minicap_28.cpp:268) Creating CPU consumer" 2024-09-16T14:29:40.069Z INF/device:plugins:screen:stream 141759 [127.0.0.1:1235] minicap says: "INFO: (external/MY_minicap/src/minicap_28.cpp:272) Creating frame waiter" 2024-09-16T14:29:40.070Z INF/device:plugins:screen:stream 141759 [127.0.0.1:1235] minicap says: "INFO: (external/MY_minicap/src/minicap_28.cpp:276) Publishing virtual display" 2024-09-16T14:29:40.070Z INF/device:plugins:screen:stream 141759 [127.0.0.1:1235] minicap says: "INFO: (jni/minicap/JpgEncoder.cpp:64) Allocating 2766852 bytes for JPG encoder" 2024-09-16T14:29:40.072Z INF/device:plugins:screen:stream 141759 [127.0.0.1:1235] Reading minicap banner 2024-09-16T14:29:40.270Z INF/device:plugins:screen:stream 141759 [127.0.0.1:1235] minicap says: "INFO: (jni/minicap/minicap.cpp:464) New client connection" 2024-09-16T14:30:00.376Z INF/device:plugins:screen:stream 141759 [127.0.0.1:1235] Requesting frame producer to stop 2024-09-16T14:30:00.377Z INF/device:plugins:screen:stream 141759 [127.0.0.1:1235] Disconnecting from minicap service 2024-09-16T14:30:00.378Z INF/device:plugins:screen:stream 141759 [127.0.0.1:1235] Stopping minicap service 2024-09-16T14:30:00.379Z INF/device:plugins:screen:stream 141759 [127.0.0.1:1235] Sending SIGTERM to minicap 2024-09-16T14:30:00.836Z INF/device:plugins:screen:stream 141759 [127.0.0.1:1235] minicap says: "INFO: (jni/minicap/minicap.cpp:200) Received SIGTERM, stopping" 2024-09-16T14:30:00.837Z INF/device:plugins:screen:stream 141759 [127.0.0.1:1235] minicap says: "INFO: (jni/minicap/minicap.cpp:536) Closing client connection" 2024-09-16T14:30:00.838Z INF/device:plugins:screen:stream 141759 [127.0.0.1:1235] minicap says: "INFO: (external/MY_minicap/src/minicap_28.cpp:291) Destroying virtual display"

denis99999 commented 1 day ago

Are you sure this phone works well on your side ? because on my side I have a timeout error while launching the STF service on the phone..

chengdada123 commented 1 day ago

The stf service on the phone does not appear in the notification bar. But it has been started. The device is online and can be used, but it keeps jumping to the above page. I guess stf is always starting in a loop?So is there some kind of BUG?You can do anything with the device, even reset it. Until the BUG is resolved

denis99999 commented 1 day ago

Yes, it loops on error, it is due to the soft phone. No, I have no time to debug this soft phone which is not officially supported by STF, sorry, but if you provide me the phone of yesterday I can take a look tomorrow on the red screen issue

chengdada123 commented 1 day ago

Dear, this is the same phone call from yesterday, except I changed the server mapping. It's because the server expired yesterday.Nothing has changed. The only change is that I restored the phone to factory settings.

denis99999 commented 1 day ago

He must not have liked the factory reset, sorry..

chengdada123 commented 1 day ago

He seems to be fine now, thanks for your help.

denis99999 commented 1 day ago

What did you change?

chengdada123 commented 1 day ago

image I turned on the notification permission,STF service is OK,but Still a red screen

denis99999 commented 1 day ago

I will take a look tomorrow on that, so reserve this phone for me!

chengdada123 commented 1 day ago

OK! Thank You Very much!

denis99999 commented 1 day ago

I just tried the phone and I have the same problem! When I launch an adb shell, executing a command is very very slow. Maybe that's why I'm getting a timeout error. It seems that the network latency and bandwidth are not sufficient, it was not the case yesterday! Are you sure you are free the phone for me? does it attached to another machine?

chengdada123 commented 1 day ago

It is true that the new server is slow, I use the local computer to Mapping Ports now. Please test.

denis99999 commented 1 day ago

Now the network is good but it does not change anything, sorry!

chengdada123 commented 1 day ago

Are you not going to repair it? Will the equipment still be kept for you? Thank you

denis99999 commented 23 hours ago

No, you can recover the phone