poky/bitbake/bin
Richard Purdie 01c1167336 bitbake: bitbake: cooker: properly fix bitbake.lock handling
If the PR server or indeed any other child process takes some time to
exit (which it sometimes does when saving its database), it can end up
holding bitbake.lock after the UI exits, which led to errors if you ran
bitbake commands successively - we saw this when running the PR server
oe-selftest tests in OE-Core. The recent attempt to fix this wasn't
quite right and ended up breaking memory resident bitbake. This time we
close the lock file when cooker shuts down (inside the UI process)
instead of unlocking it, and this is done in the cooker code rather than
the actual UI code so it doesn't matter which UI is in use. Additionally
we report that we're waiting for the lock to be released, using lsof or
fuser if available to list the processes with the lock open.

The 'magic' in the locking is due to all spawned subprocesses of bitbake
holding an open file descriptor to the bitbake.lock. It is automatically
unlocked when all those fds close the file (as all the processes terminate).
We close the UI copy of the lock explicitly, then close the server process
copy, any remaining open copy is therefore some proess exiting.

(The reproducer for the problem is to set PRSERV_HOST = "localhost:0"
and add a call to time.sleep(20) after self.server_close() in
lib/prserv/serv.py, then run "bitbake -p; bitbake -p" ).

Cleanup work done by Paul Eggleton <paul.eggleton@linux.intel.com>.

This reverts bitbake commit 69ecd15aece54753154950c55d7af42f85ad8606 and
e97a9f1528d77503b5c93e48e3de9933fbb9f3cd.

(Bitbake rev: a29780bd43f74b7326fe788dbd65177b86806fcf)

(Bitbake rev: 830b8f31459ca484bdaf2caa8ff4b7cbf21c77ac)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>

Signed-off-by: Saul Wold <sgw@linux.intel.com>

Conflicts:
	bitbake/lib/bb/cooker.py
	bitbake/lib/bb/main.py
	bitbake/lib/bb/tinfoil.py
	bitbake/lib/bb/ui/knotty.py
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-01 21:37:33 +01:00
..
bitbake bitbake: bitbake: cooker: properly fix bitbake.lock handling 2015-09-01 21:37:33 +01:00
bitbake-diffsigs bitbake: bitbake-diffsigs: Fix runtime error when no arguments are given 2014-04-27 01:27:55 +01:00
bitbake-dumpsig bitbake: bitbake-dumpsig: introduce command line and error handling 2013-10-07 09:37:35 +01:00
bitbake-layers bitbake: bitbake: show wildcard appends for bitbake-layers 2014-06-06 10:33:19 +01:00
bitbake-prserv bitbake/bitbake-prserv: Set file mode bits "x". 2012-03-02 16:22:27 +00:00
bitbake-selftest bitbake: bitbake-selftest: fix help message to include command line 2014-04-09 14:31:14 +01:00
bitbake-worker bitbake: bitbake-worker: Use setsid() rather than setpgid() 2015-02-11 17:36:50 +00:00
bitdoc bitbake: Update users of getVar/setVar to use the data store functions directly 2011-11-27 10:35:30 +00:00
image-writer bitbake: hig.py: refactor into individual components 2013-01-16 12:51:33 +00:00
toaster bitbake: toaster: bitbake server listen on all interface 2014-09-05 10:14:24 +01:00