diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-07-31 10:16:33 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-09-01 21:37:33 +0100 |
commit | 01c1167336e5e75077ceb46b6cc43981e09317f6 (patch) | |
tree | 5046459b1ac1ed3cbd3cee1f5effc0e22e2bb86f /bitbake/lib/bb/ui/knotty.py | |
parent | c1803b774a247522378edfd116bf44614352fdc4 (diff) | |
download | poky-01c1167336e5e75077ceb46b6cc43981e09317f6.tar.gz |
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>
Diffstat (limited to 'bitbake/lib/bb/ui/knotty.py')
-rw-r--r-- | bitbake/lib/bb/ui/knotty.py | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py index 9e58b31727..84664551df 100644 --- a/bitbake/lib/bb/ui/knotty.py +++ b/bitbake/lib/bb/ui/knotty.py | |||
@@ -536,24 +536,29 @@ def main(server, eventHandler, params, tf = TerminalFilter): | |||
536 | if not params.observe_only: | 536 | if not params.observe_only: |
537 | _, error = server.runCommand(["stateForceShutdown"]) | 537 | _, error = server.runCommand(["stateForceShutdown"]) |
538 | main.shutdown = 2 | 538 | main.shutdown = 2 |
539 | summary = "" | 539 | try: |
540 | if taskfailures: | 540 | summary = "" |
541 | summary += pluralise("\nSummary: %s task failed:", | 541 | if taskfailures: |
542 | "\nSummary: %s tasks failed:", len(taskfailures)) | 542 | summary += pluralise("\nSummary: %s task failed:", |
543 | for failure in taskfailures: | 543 | "\nSummary: %s tasks failed:", len(taskfailures)) |
544 | summary += "\n %s" % failure | 544 | for failure in taskfailures: |
545 | if warnings: | 545 | summary += "\n %s" % failure |
546 | summary += pluralise("\nSummary: There was %s WARNING message shown.", | 546 | if warnings: |
547 | "\nSummary: There were %s WARNING messages shown.", warnings) | 547 | summary += pluralise("\nSummary: There was %s WARNING message shown.", |
548 | if return_value and errors: | 548 | "\nSummary: There were %s WARNING messages shown.", warnings) |
549 | summary += pluralise("\nSummary: There was %s ERROR message shown, returning a non-zero exit code.", | 549 | if return_value and errors: |
550 | "\nSummary: There were %s ERROR messages shown, returning a non-zero exit code.", errors) | 550 | summary += pluralise("\nSummary: There was %s ERROR message shown, returning a non-zero exit code.", |
551 | if summary: | 551 | "\nSummary: There were %s ERROR messages shown, returning a non-zero exit code.", errors) |
552 | print(summary) | 552 | if summary: |
553 | 553 | print(summary) | |
554 | if interrupted: | 554 | |
555 | print("Execution was interrupted, returning a non-zero exit code.") | 555 | if interrupted: |
556 | if return_value == 0: | 556 | print("Execution was interrupted, returning a non-zero exit code.") |
557 | return_value = 1 | 557 | if return_value == 0: |
558 | return_value = 1 | ||
559 | except IOError as e: | ||
560 | import errno | ||
561 | if e.errno == errno.EPIPE: | ||
562 | pass | ||
558 | 563 | ||
559 | return return_value | 564 | return return_value |