On Thu, Jun 22, 2017 at 8:42 AM, <
miles....@gmail.com> wrote:
> Hi Dmitry,
>
> I know there's already a delay (30 * 5 secs) in
>
https://github.com/google/syzkaller/blob/master/vm/adb/adb.go#L311
> But the problem is that the current delay does not include checking the
> "unavailable battery service (i.e. Can't find service: battery)".
>
> No infinite delay needed.
>
> After applying the below change, I can get the correct battery of my device
> after 6 times of retry at most.
> ------------------------------------------------------------------------------------
> [vm/adb/adb.go]
>
> - for ; numRetry >= 0 && err != nil; numRetry-- {
> + for ; numRetry >= 0 && ((err != nil) ||
> (strings.Contains(string(out), "Can't find service"))); numRetry-- {
> ------------------------------------------------------------------------------------
>
> Syzkaller will do the "adb reboot" each time when getting the battery result
> "unavailable battery service".
> So this change helps me a lot.
You mean that err == nil when dumpsys returns "Can't find service"? If
yes, then that's the problem that we need to fix.
Does dumpsys itself fail in such case? If yes, then we need to remove
grep from the command and parse it manually.
What you propose is an infinite loop is we don't assume that the
device behaves in a sane way. First, we had a bunch of similar
problems during boot. Second, we proactively try to break it. We
absolutely must not assume that it will behave in a sane way. Consider
that you start fuzzing and go to a vacation. A month later you expect
to see lots of bugs, but instead you discover it was waiting for the
battery service to come up for the whole month.