I don't see how that code should be consuming 100% of the CPU. On any error, 
len should be coming back as -1 which will break out of the loop. It will, 
however toss data though.

If the loop executes more than once, the data read from the everything except 
the last iteration is thrown away.

Dave Hylands

----- Original Message -----
> From: "Thinker K.F. Li" <thin...@codemud.net>
> To: dev-b2g@lists.mozilla.org
> Sent: Saturday, May 25, 2013 3:57:45 AM
> Subject: Re: [b2g] b2g 100% cpu usage
> 
> pipeHandler() is for signaling of dispatching input events or other
> events.  If you can break on nsAppShell::NotifyNativeEvent() and
> paste
> the backtrace here.  It may be helpful.
>  
> 
> pancake <panc...@youterm.com> writes:
> 
> > On 05/24/13 14:59, Justin Lebar wrote:
> >> This should be very easy to debug.
> >>
> >> Just attach gdb to the relevant process (./run-gdb.sh attach PID
> >> --
> >> you can find the pid by running adb shell b2g-ps), then break on
> >> |read|, then you should quite quickly find out who's calling read
> >> |in a
> >> loop.
> >>
> >> The real question will be why we get an infinite loop of
> >> EAGAIN's...
> >
> > b2g has 36 threads running.. after setting a breakpoint on "read" i
> > got the thread.
> >
> > this is the backtrace:
> >
> > (gdb) bt
> > #0  read () at bionic/libc/arch-arm/syscalls/read.S:8
> > #1  0x41379de6 in pipeHandler (fd=35, data=<value optimized out>)
> >     at /home/pancake/prg/B2G/gecko/widget/gonk/nsAppShell.cpp:101
> > #2  0x41379cbe in FdHandler::run (this=0x4391bca0, mayWait=<value
> > optimized out>)
> >     at /home/pancake/prg/B2G/gecko/widget/gonk/nsAppShell.h:50
>  ......... skip ...............
> 
> --
> Sinker
> --
> 天教懶漫帶疏狂
> _______________________________________________
> dev-b2g mailing list
> dev-b2g@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-b2g
> 
_______________________________________________
dev-b2g mailing list
dev-b2g@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-b2g

Reply via email to