Closed Bug 882357 Opened 11 years ago Closed 8 years ago

devicemanagerADB getProcessList / processExists sometimes returns wrong pid

Categories

(Testing :: Mozbase, defect)

x86
Android
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: gbrown, Assigned: gbrown)

Details

devicemanager.processExists uses getProcessList to retrieve a list of pids and process names, then returns the pid associated with a specified process name. 

devicemanagerADB.getProcessList retrieves process info returned by ps, but the ps format is different on different devices. getProcessList tries to detect the format and adjust the returned process list accordingly, but the check is too simplistic:

            # we need to figure out if this is "user pid name" or "pid user vsz stat command"
            if els[1].isdigit():
                ret.append(list([int(els[1]), els[len(els) - 1], els[0]]))
            else:
                ret.append(list([int(els[0]), els[len(els) - 1], els[1]]))

On the Galaxy Nexus with Android 4.0.1, ps produces:

PID   USER     TIME   COMMAND
    1 root       0:04 /init
    2 root       0:00 [kthreadd]
    3 root       0:00 [ksoftirqd/0]
...
 9916 root       0:00 [kworker/1:0]
10030 10038      0:03 {a.fennec_mozdev} org.mozilla.fennec_mozdev
10113 root       0:00 /system/bin/sh -c ps
10115 root       0:00 ps

as a result, processExist may return 10038 as Fennec's pid.
Not such a problem with modern Android.
Assignee: nobody → gbrown
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.