Closed Bug 809366 Opened 8 years ago Closed 8 years ago

watcher has high cpu usage on panda boards in racked environment

Categories

(Testing Graveyard :: SUTAgent, defect)

ARM
Android
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla19

People

(Reporter: jmaher, Assigned: jmaher)

Details

Attachments

(1 file)

watcher gets into a situation where it spins forever on getProcessInfo: http://mxr.mozilla.org/mozilla-central/source/build/mobile/sutagent/android/watcher/WatcherService.java#951.  I suspect there is an issue with the timer scheduled task stuff, I have some workarounds in place, but I am not sure if they will really help.  I only can seem to reproduce this in the live environment, not at home.

wlach says:
It sounds like maybe scheduleFixedRate, which we're using to time the
checking for the agent process, could potentially be called rapidly in
succession under some circumstances, which could certainly lead to problems:

http://docs.oracle.com/javase/1.4.2/docs/api/java/util/Timer.html#scheduleAtFixedRate%28java.util.TimerTask,%20long,%20long%29

It sounds like we might do better to just use schedule here, which will
do the most possible to make sure events happen on a regular interval:

http://docs.oracle.com/javase/1.4.2/docs/api/java/util/Timer.html#schedule%28java.util.TimerTask,%20java.util.Date,%20long%29

(we're bound to see some weird behaviour if the timer events don't get
called when we expect but hopefully we won't go bonkers and try to get
the process list 1000 times in a row or whatever)
Assignee: nobody → jmaher
Status: NEW → ASSIGNED
Attachment #679259 - Flags: review?(wlachance)
Comment on attachment 679259 [details] [diff] [review]
use timer.schedule and add a state variable so we only do this once (1.0)

Did you actually observe the start message handler being triggered more than once? Not sure if that's technically possible. Regardless, this pretty much looks ok.

># HG changeset patch
># Parent 18f1652907113352fd3ea174f2ee6398c2d3963c
>Bug 809366 - watcher has high cpu usage on panda boards in racked environment. r=wlach
>

>+                if (this.bStartedTimer == false) {

(!this.bStartedTimer) is more concise
Attachment #679259 - Flags: review?(wlachance) → review+
I never saw it called more than once, but I wanted to do what I could inside the code to prevent >1 call to the timer.schedule*() command.
https://hg.mozilla.org/mozilla-central/rev/e97f0b690380
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla19
Product: Testing → Testing Graveyard
You need to log in before you can comment on or make changes to this bug.