Bug 7138

Summary: bitbake -e with knotty spins if stdout is paginated
Product: [Build System, Metadata & Runtime] BitBake Reporter: Magnus Olsson <magnus>
Component: bitbakeAssignee: Richard Purdie <richard.purdie>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Low CC: poky.bs.watcher, poky.watcher
Version: unspecified   
Target Milestone: 1.8   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Magnus Olsson 2015-01-14 10:09:16 UTC
I often use "bitbake -e core-image-minimal | less" to interactively grep for variable values etc. 

While 'less' is blocking stdout, bitbake will use 100% CPU on one core until I scroll to the end of output (or quit 'less' to break the pipe).

This is not a big deal, but if you like me keep one of these less-invokations running while writing recipes (to review variables), the CPU fan on my laptop will go nuts.

I use bitbake 1.22, but I was also able to reproduce this on bitbake master (1ea658dcdfde5465d3ecdb97550e0a66cb8b122e as of writing, 2015-01-14).

I expect bitbake with knotty UI to behave like other console programs, such as:

   python -c 'while True: print("foo")'  | less

.. which consumes no CPU while being blocked.
Comment 1 Richard Purdie 2015-01-21 16:39:12 UTC
Some notes on this. If you specify bitbake -t xmlrpc, the system doesn't show the problem. Its therefore something to do with the process backend.

It appears the cooker is trying to send an event to the client and the client is blocked sending data to the terminal. This leads to the event queue using a processor.
Comment 2 Richard Purdie 2015-01-21 17:44:34 UTC
I think I found the problem, a bogus fd in a select call. Patch on the bitbake list.