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

"Device is busy or blocked" how can I get around this error? #1441

Open
tking16 opened this issue Nov 12, 2024 · 11 comments
Open

"Device is busy or blocked" how can I get around this error? #1441

tking16 opened this issue Nov 12, 2024 · 11 comments

Comments

@tking16
Copy link

tking16 commented Nov 12, 2024

Describe the bug

I have setup of two physical Android Samsung devices, recently I've been getting tests fail whereby the app won't even start on one of the devices. The other device is running the tests as normal, not sure if this is a device-farm issue or uiAutomator2 issue either. The error message advised to increase androidTimeoutInstall which made no difference.

E       selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Device is busy or blocked.. Device request: {"platform":"android"}
E       Stacktrace:
E       UnknownError: An unknown server-side error occurred while processing the command. Original error: Device is busy or blocked.. Device request: {"platform":"android"}

Link to Appium logs

appium.log

Environment

I had similar issues on device-farm v9.0.1 but that had a slightly different error, about being unable to install the APK

@saikrishna321
Copy link
Member

@tking16 In the given logs I cannot find the error, this generally happens when the requested device is not free based on the filter.

@tking16
Copy link
Author

tking16 commented Nov 12, 2024

@saikrishna321 It occurs twice in the logs, here's a snippet:

2024-11-12 12:27:16:490 - �[38;5;17m[device-farm-main]�[0m Received non-webdriver request with url /device-farm/api/status. So, not proxying it to downstream.
2024-11-12 12:27:16:491 - �[38;5;86m[HTTP]�[0m <-- GET /device-farm/api/status 200 1 ms - 66 
2024-11-12 12:27:18:822 - �[38;5;17m[device-farm-main]�[0m Updated devices with filter: {"platform":"android"}
2024-11-12 12:27:18:823 - �[38;5;103m[AppiumDriver@6af6]�[0m 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"].
2024-11-12 12:27:18:823 - �[38;5;103m[AppiumDriver@6af6]�[0m Encountered internal error running command: Error: Device is busy or blocked.. Device request: {"platform":"android"}
    at generator (/Users/jenkins/actions-runner/_at-tests/guacamole/guacamole/testing/app-at/node_modules/appium-device-farm/lib/webpack:/appium-device-farm/lib/src/device-utils.js:148:19)
    at Generator.next (<anonymous>)
    at oj (/Users/jenkins/actions-runner/_at-tests/guacamole/guacamole/testing/app-at/node_modules/appium-device-farm/lib/webpack:/appium-device-farm/lib/src/device-utils.js:5:48)

That's very strange, is there any command I can run to "free up" the devices or anything, can't imagine why they'd be blocked as only one instance of the tests run at a time...

@saikrishna321
Copy link
Member

saikrishna321 commented Nov 12, 2024

@tking16 This is very weird.

Error: Device is busy or blocked.. Device request: {"platform":"android"} We should be getting the device udid and also busy attribute in the request.

https://github.com/AppiumTestDistribution/appium-device-farm/blob/main/src/device-utils.ts#L154

@tking16
Copy link
Author

tking16 commented Nov 12, 2024

From checking the logs, the UDID is just the phone's IP address, is that expected?

2024-11-12 12:31:19:089 - �[38;5;228m[e9ea86b8]�[0m�[38;5;229m[ADB]�[0m Connected devices: [{"udid":"10.35.120.55:5555","state":"device"},{"udid":"10.35.120.32:5555","state":"device"}]

@tking16
Copy link
Author

tking16 commented Nov 12, 2024

Screenshot 2024-11-12 at 17 11 47 The device on the right is one not being used despite it being listed as "busy". I noticed it has no session-ID either

@saikrishna321
Copy link
Member

saikrishna321 commented Nov 13, 2024

@tking16 UDID is just what is returned by the adb devices.

Now in the screenshot I see UDID is different from the one in the logs

@tking16
Copy link
Author

tking16 commented Nov 13, 2024

Really, they look the same to me as in the logs, I did block them out but I'm probably just being overly cautious, here's the screenshot without the grey blocks
Screenshot 2024-11-13 at 09 42 40

@tking16
Copy link
Author

tking16 commented Nov 13, 2024

@saikrishna321 Okay so this is interesting, I managed to grab the exact device from the office today and set up local device-farm session and see if I could reproduce, all the tests failed immediately and the device became marked as "busy", but a more obvious error became noticeable:

E       selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Error executing adbExec. Original error: 'Command '/Users/theo.king/Library/Android/sdk/platform-tools/adb -P 5037 -s 10.63.162.49\:5555 install -r /Users/theo.king/code/guacamole/testing/app-at/node_modules/appium-device-farm/lib/stream.apk' exited with code 1'; Command output: adb: failed to install /Users/theo.king/code/guacamole/testing/app-at/node_modules/appium-device-farm/lib/stream.apk: Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE: Existing package com.device.farm signatures do not match newer version; ignoring!]
E
E       Stacktrace:
E       UnknownError: An unknown server-side error occurred while processing the command. Original error: Error executing adbExec. Original error: 'Command '/Users/theo.king/Library/Android/sdk/platform-tools/adb -P 5037 -s 10.63.162.49\:5555 install -r /Users/theo.king/code/guacamole/testing/app-at/node_modules/appium-device-farm/lib/stream.apk' exited with code 1'; Command output: adb: failed to install /Users/theo.king/code/guacamole/testing/app-at/node_modules/appium-device-farm/lib/stream.apk: Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE: Existing package com.device.farm signatures do not match newer version; ignoring!]
E
E           at getResponseForW3CError (/Users/theo.king/code/guacamole/testing/app-at/node_modules/@appium/base-driver/lib/protocol/errors.js:1145:9)
E           at asyncHandler (/Users/theo.king/code/guacamole/testing/app-at/node_modules/@appium/base-driver/lib/protocol/protocol.js:485:57)

_env/lib/python3.9/site-packages/selenium/webdriver/remote/errorhandler.py:229: WebDriverException

I need to look into this INSTALL_FAILED_UPDATE_INCOMPATIBLE

@tking16
Copy link
Author

tking16 commented Nov 13, 2024

Update: I managed to resolve the issue by deleting the device-farm APK that was on the broken phone. I assume that was the 9.0.1 version and device farm was getting confused

@sudharsan-selvaraj
Copy link
Member

Can you also update the device farm plugin to the latest version?

@tking16
Copy link
Author

tking16 commented Nov 13, 2024

@sudharsan-selvaraj I'm on v9.4.5

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

No branches or pull requests

3 participants