[mozdevice] mozdevice hangs when there is no permissions to use the device

RESOLVED FIXED in Firefox 46

Status

Testing
Mozbase
RESOLVED FIXED
2 years ago
2 years ago

People

(Reporter: parkouss, Assigned: parkouss)

Tracking

unspecified
mozilla46
Points:
---

Firefox Tracking Flags

(firefox46 fixed)

Details

MozReview Requests

Submitter Diff Changes Open Issues Last Updated
Loading...
Error loading review requests:

Attachments

(1 attachment)

(Assignee)

Description

2 years ago
I see this using mozregression on archlinux. Basically there is not enough permissions to use the device, and the side effect is that mozregression (and mozdevice) just hang while trying to interact with it.

> adb devices -l
> * daemon not running. starting it now on port 5037 *
> * daemon started successfully *
> List of devices attached 
> ????????????           no permissions usb:3-1

It appears that it is possible to have this issue on ubuntu,

https://rechtzeit.wordpress.com/2011/02/24/adb-devices-shows-no-permissions/

This is basically an user system issue that should probably be fixed with udev config - but mozdevice should inform that something is wrong, and not hang that way.

I believe a call like this:

>>> devices = ADBHost().devices()
should raise an exception instead of returning:
>>> devices
[{'state': 'no permissions', 'device_serial': '????????????', 'usb': '3-1'}]

This call does block:
>>> adb = ADBAndroid()

Because it calls:
['adb', 'devices', '-l']
['adb', '-s', '????????????', 'wait-for-device', 'shell', 'id; echo rc=$?']
(Assignee)

Comment 1

2 years ago
Created attachment 8703634 [details]
MozReview Request: Bug 1236467 - [mozdevice] raise exception when missing devices access permissions. r=ahal

Review commit: https://reviewboard.mozilla.org/r/29419/diff/#index_header
See other reviews: https://reviewboard.mozilla.org/r/29419/
Attachment #8703634 - Flags: review?(ahalberstadt)
Comment on attachment 8703634 [details]
MozReview Request: Bug 1236467 - [mozdevice] raise exception when missing devices access permissions. r=ahal

https://reviewboard.mozilla.org/r/29419/#review26249

Lgtm!

::: testing/mozbase/mozdevice/mozdevice/adb.py:484
(Diff revision 1)
> +                raise ADBListDevicesError("No permissions to detect devices",
> +                                          devices)

Might be good to add a hint on how to solve it like "Configure udev rule" or something similar.
Attachment #8703634 - Flags: review?(ahalberstadt) → review+
(Assignee)

Comment 3

2 years ago
Thanks Andrew! I am not sure if udev is everywhere (probably, though). I just read the arch wiki, they recommend to restart the server as root (https://wiki.archlinux.org/index.php/Android, search for ???).

I will mix the two possible answers, I think it's worth it - I update the patch, you'll tell me.
(Assignee)

Comment 4

2 years ago
Comment on attachment 8703634 [details]
MozReview Request: Bug 1236467 - [mozdevice] raise exception when missing devices access permissions. r=ahal

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/29419/diff/1-2/
(Assignee)

Comment 5

2 years ago
Comment on attachment 8703634 [details]
MozReview Request: Bug 1236467 - [mozdevice] raise exception when missing devices access permissions. r=ahal

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/29419/diff/2-3/
(Assignee)

Comment 6

2 years ago
Just fixed a nit;

So this looks like:

>>> from mozdevice.adb import ADBHost
>>> devices = ADBHost().devices()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/jp/dev/mozilla-central/testing/mozbase/mozdevice/mozdevice/adb.py", line 489, in devices
    devices)
mozdevice.adb.ADBListDevicesError: No permissions to detect devices. You should restart the adb server as root:

# adb kill-server
# adb start-server

or maybe configure your udev rules.
Assignee: nobody → j.parkouss
Status: NEW → ASSIGNED

Comment 10

2 years ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/e2be5a2e6760
Status: ASSIGNED → RESOLVED
Last Resolved: 2 years ago
status-firefox46: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla46
(Assignee)

Comment 11

2 years ago
Hum, I had an issue trying to upload that to pypi:

> Submitting dist/mozdevice-0.48.tar.gz to https://pypi.python.org/pypi
> Upload failed (500): Internal Server Error
> error: Upload failed (500): Internal Server Error

Though I can install the 0.48 package, and with mozregression it is working well, so I'm inclined to think that nothing is broken.

Ahal, do you think we should still try to release a new version ?
Flags: needinfo?(ahalberstadt)
So you're saying you can pip install 0.48? Sounds like something went wrong after the package got uploaded, so maybe we're good in that case. My philosophy is to only bother with versioning if something is broken or something requires the new change.
Flags: needinfo?(ahalberstadt)
You need to log in before you can comment on or make changes to this bug.