Bug 7993

Summary: pseudo: select returns immediately on FIFO
Product: [Yocto Project Subprojects] Pseudo Reporter: Paul Eggleton <bluelightning>
Component: pseudoAssignee: Seebs <seebs>
Status: VERIFIED FIXED QA Contact: Daniel Istrate <daniel.alexandrux.istrate>
Severity: normal    
Priority: Medium+ CC: alexandru.c.georgescu, ross.burton, seebs, yp.pseudo.watcher, yp.watcher
Version: unspecified   
Target Milestone: 1.9 M2   
Hardware: All   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)
Attachments:
Description Flags
Test script to demonstrate the issue none

Description Paul Eggleton 2015-07-14 12:43:15 UTC
Created attachment 2588 [details]
Test script to demonstrate the issue

With a recent change in BitBake we are creating a FIFO for each shell task and then writing to it when bbnote/bbwarn/bberror etc. are called (see bug 5275 for details). Unfortunately this has exposed a bug in pseudo: calling select() on a FIFO created with mkfifo() under pseudo returns immediately instead of waiting until there is some data to read, even when the FIFO is opened read/write. This has led to a performance regression.

A test case is attached - run it outside of pseudo and it behaves correctly, only printing what is echoed into the FIFO; run it under pseudo and it will print out empty strings repeatedly.

Richard also has a patch which does appear to fix the issue but needs work:

http://git.yoctoproject.org/cgit.cgi/poky-contrib/patch/?id=ef004bfbad695dcd7c9001b7529181ae72d45162
Comment 1 Ross Burton 2015-07-23 20:41:44 UTC
Fixed in pseudo 1.6.7, merged in oe-core 0295947a2ccc66037f9c20f06b4b69a781a046bd.
Comment 2 Daniel Istrate 2015-09-22 15:13:11 UTC
Verified on master: 7b86c771c80d0759c2ca0e57c46c4c966f89c49e

Steps to verify:
1. Download the attached script and run it
2. In another terminal run: echo test > /tmp/testfifo --> You should see the echoed message in the first terminal where the script is running.

Now to test for pseudo:
1. Start the pseudo env with: bitbake m4 -c devshell 
2. In the shell that pops up copy the attached script and run it
3. In another terminal run: echo test > /tmp/testfifo --> You should see the echoed message in the pseudo env where the script is running.