Bug 5470 (tinfoil2) - bitbake-layers cannot be used with memory resident bitbake running
Summary: bitbake-layers cannot be used with memory resident bitbake running
Status: VERIFIED FIXED
Alias: tinfoil2
Product: BitBake
Classification: Build System, Metadata & Runtime
Component: bitbake (show other bugs)
Version: unspecified
Hardware: x86 Multiple
: High normal
Target Milestone: 2.3 M2
Assignee: Aníbal Limón
QA Contact: oscar lopez arandas
URL: https://wiki.yoctoproject.org/wiki/Ti...
Whiteboard:
Depends on:
Blocks: 7555 8735 10200 10516
  Show dependency tree
 
Reported: 2013-11-05 11:09 UTC by Andreea Brandusa Proca
Modified: 2017-03-28 22:41 UTC (History)
10 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments
bitbake-layers show-layers (1.83 KB, application/octet-stream)
2017-03-28 22:24 UTC, oscar lopez arandas
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andreea Brandusa Proca 2013-11-05 11:09:32 UTC
Steps to reproduce:
1. Build an image, for example;
2. Wait until it finishes;
3. run "bitbake-layers show_layers"

I receive this error:
"Error: Only one copy of bitbake should run against a build."
Comment 1 Paul Eggleton 2013-11-05 11:40:56 UTC
This will apply to any tool that uses the tinfoil module. Unfortunately I suspect this means tinfoil will need to be reworked.
Comment 2 Leonardo Sandoval Gonzalez 2015-06-11 22:32:01 UTC
(In reply to comment #1)
> This will apply to any tool that uses the tinfoil module. Unfortunately I
> suspect this means tinfoil will need to be reworked.

Paul, do you have a design/plan to overcome this? devtool is also affected by tinfoil. One approach would be to consider the app name (bitbake, bitbake-layers, devtool, etc) and just make the bitbake.lock check if app == bitbake.
Comment 3 Paul Eggleton 2015-06-12 08:21:06 UTC
Actually I've got more than a design - I have an initial version in a contrib branch here:

http://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/log/?h=paule/tinfoil2

It still has a lot of rough edges; at the moment I'm mostly waiting for responses on an RFC regarding a proper API for tinfoil before proceeding:

http://lists.openembedded.org/pipermail/openembedded-core/2015-June/105804.html

When this first came up I did consider workarounds similar to what you are describing, but given the way bitbake works there's not currently a safe way for two servers to access the same set of cache files without a bunch more locking in place.
Comment 4 Paul Eggleton 2015-08-20 07:57:24 UTC
FYI work on this has stalled for now - it's turned out to be significantly more complicated than I'd anticipated, not only because there were more places that needed changing, but I also discovered a number of problems with memory resident mode that need fixing at the same time in order to make this of any use.

I have sent the patches I have up to this point that are independent of the tinfoil refactoring itself, and these have now been merged. I've rebased the paule/tinfoil2 branch on poky-contrib on top of latest master as well.
Comment 5 Paul Eggleton 2015-11-30 09:25:49 UTC
I've rebased the paule/tinfoil2 branch in poky-contrib on top of master and fixed it again so that at least the devtool, recipetool and bblayers oe-selftest tests pass. There's still quite a lot of cleanup and additional testing required though, and memres still needs work - e.g. I'm not actually witnessing any noticeable performance gain from using it at the moment.
Comment 6 Benjamin Esquivel 2015-11-30 17:01:00 UTC
I guess that the performance gains of using memres over regular setenv not only need to be noticeable but measurable. Leo, it would be nice to identify which performance parameters can be used to measure the improvements of using memres.
Comment 7 Benjamin Esquivel 2016-11-03 22:18:26 UTC
Waiting on Paul to provide a rebased-to-master branch of tinfoil2.
Comment 8 Paul Eggleton 2016-11-21 09:09:16 UTC
I have rebased the branch on top of master and fixed a bunch of issues today - the basics are at least working. I'll keep poking at it.
Comment 9 Benjamin Esquivel 2016-11-22 21:02:54 UTC
assigning back to Anibal since Paul has already provided a rebased branch. Leo is pending to free up Anibal's workload to see if this can be pulled in for 2.3 M1.
Comment 10 Paul Eggleton 2016-11-22 21:23:18 UTC
Note that I am still working on this in the mean time.
Comment 11 Paul Eggleton 2016-11-28 22:23:25 UTC
OK, I have just pushed another branch with a whole bunch of issues fixed. I've also written the following wiki page with some background and the current status:

https://wiki.yoctoproject.org/wiki/Tinfoil2
Comment 12 Benjamin Esquivel 2016-11-29 22:59:09 UTC
(In reply to comment #11)
> OK, I have just pushed another branch with a whole bunch of issues fixed.
> I've also written the following wiki page with some background and the
> current status:
> 
> https://wiki.yoctoproject.org/wiki/Tinfoil2

okay Paul, is this good now for taking over?
Comment 13 Aníbal Limón 2017-01-09 22:44:41 UTC
This bug was fixed by Paul with recently tinfoil2 changes hash [1],

We need to add more extensive tenting to memres, i'll setup an AB to make periodic runs of memres and discover more bugs.


[1] http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=358befb76ede4b111a9ee913ae2586ea30dc23b7
Comment 14 Benjamin Esquivel 2017-01-16 20:56:40 UTC
Great Anibal, I guess it starts with a buildset that does oe-selftest from a memres environment.
Comment 15 oscar lopez arandas 2017-03-28 19:51:17 UTC
BUILD: 2.3.m3.rc1: master:415b72ffcbd26e5f3664370d8b2a9b8105fb6342
ENVIRONMENT: genericx86


Steps to reproduce:
1. Build an image: core-image-sato
2. Wait until it finishes;
3. run "bitbake-layers show_layers"

I receive this:
scar@oscar-ThinkPad-T540p:~/layers/build$ bitbake-layers show-layers
layer                 path                                      priority
==========================================================================
meta                  /home/oscar/layers/meta                   5
meta-poky             /home/oscar/layers/meta-poky              5
meta-yocto-bsp        /home/oscar/layers/meta-yocto-bsp         5
Comment 16 Paul Eggleton 2017-03-28 20:16:30 UTC
(In reply to comment #15)
> BUILD: 2.3.m3.rc1: master:415b72ffcbd26e5f3664370d8b2a9b8105fb6342
> ENVIRONMENT: genericx86
> 
> 
> Steps to reproduce:
> 1. Build an image: core-image-sato
> 2. Wait until it finishes;
> 3. run "bitbake-layers show_layers"

Your steps didn't mention how you initialised your environment, did you use oe-init-build-env or oe-init-build-env-memres?
Comment 17 oscar lopez arandas 2017-03-28 21:37:19 UTC
Initialize environment with oe-init-build-env.
Comment 18 Aníbal Limón 2017-03-28 21:50:51 UTC
(In reply to comment #17)
> Initialize environment with oe-init-build-env.

Hi Oscar,

You need to use oe-init-build-env-memres because without it memory resident mode isn't activated.

Please run again your tests using memres script.

Anibal
Comment 19 oscar lopez arandas 2017-03-28 22:24:30 UTC
Created attachment 3677 [details]
bitbake-layers show-layers
Comment 20 oscar lopez arandas 2017-03-28 22:26:45 UTC
BUILD: 2.3.m3.rc1: master:415b72ffcbd26e5f3664370d8b2a9b8105fb6342
ENVIRONMENT: genericx86


Steps to reproduce:
1. Initialize environment with oe-init-build-env-memres
2. Build an image: core-image-sato
3. Wait until it finishes;
4. I run "bitbake-layers show-layers"
Comment 21 Aníbal Limón 2017-03-28 22:41:11 UTC
(In reply to comment #19)
> Created attachment 3677 [details]
> bitbake-layers show-layers

Good, thanks!.