All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maxim Uvarov <maxim.uvarov@linaro.org>
To: Paul Barker <pbarker@konsulko.com>
Cc: openembedded-core <openembedded-core@lists.openembedded.org>
Subject: Re: [PATCHv2] wic: fix images build in parallel
Date: Fri, 17 Jan 2020 15:39:15 +0300	[thread overview]
Message-ID: <CAD8XO3ay-B71BNHQLtkj7WhZDe5s6vhpV79aZfjmsRYGJZZNxA@mail.gmail.com> (raw)
In-Reply-To: <CAM9ZRVs6axWKQENqLCA2Pr=nusuyia8jNEic+HPLN5zKyhR1OQ@mail.gmail.com>

On Fri, 17 Jan 2020 at 15:27, Paul Barker <pbarker@konsulko.com> wrote:
>
> On Fri, 17 Jan 2020 at 12:17, Paul Barker <pbarker@konsulko.com> wrote:
> >
> > On Fri, 17 Jan 2020 at 11:59, Maxim Uvarov <maxim.uvarov@linaro.org> wrote:
> > >
> > > On Fri, 17 Jan 2020 at 13:18, Paul Barker <pbarker@konsulko.com> wrote:
> > > >
> > > > On Mon, 13 Jan 2020 at 14:12, Maxim Uvarov <maxim.uvarov@linaro.org> wrote:
> > > > >
> > > > > On Mon, 13 Jan 2020 at 17:00, Paul Barker <pbarker@konsulko.com> wrote:
> > > > > >
> > > > > > On Mon, 13 Jan 2020 at 13:57, Maxim Uvarov <maxim.uvarov@linaro.org> wrote:
> > > > > > >
> > > > > > > On Mon, 13 Jan 2020 at 16:31, Paul Barker <pbarker@konsulko.com> wrote:
> > > > > > > >
> > > > > > > > On Mon, 13 Jan 2020 at 13:08, Maxim Uvarov <maxim.uvarov@linaro.org> wrote:
> > > > > > > > >
> > > > > > > > > OE wic plugins create temporary file with the index of the line
> > > > > > > > > tmp file name. This causes race in case several builds run in time.
> > > > > > > > > Add more entropy as timestamp to remove this race.
> > > > > > > >
> > > > > > > > How would two wic images to be built in parallel with the same work
> > > > > > > > directory? To my understanding an image recipe only supports building
> > > > > > > > a single wic image.
> > > > > > > >
> > > > > > > > Thanks,
> > > > > > > > Paul
> > > > > > >
> > > > > > > bitbake image1 image2 image3
> > > > > > > all images build .wics and use about the same files, like firmware.
> > > > > > > Issue is similar to that:
> > > > > > > https://www.yoctoproject.org/pipermail/yocto/2018-June/041373.html
> > > > > >
> > > > > > Each image has its own work directory though.
> > > > > >
> > > > > > I'll take a look in more detail later today or tomorrow, if wic is
> > > > > > writing temporary files outside of the work directory then that's a
> > > > > > bug and should be fixed.
> > > > >
> > > > > Thanks. I saw bug in rawcopy plugin. All other places were patched due
> > > > > to the same code.  I guess then for rawcopy temp files are in
> > > > > DEST_IMAGE_DIR (which is common) instead of WORKDIR.
> > > >
> > > > I can't see how these files can possibly collide across parallel image
> > > > builds. In the lines you changed in your patch, cr_workdir passed in
> > > > as an argument set to imager.workdir (in
> > > > scripts/lib/wic/plugins/imager/direct.py) which is a temporary
> > > > directory created under options.outdir. image_types_wic.bbclass passes
> > > > the -o option to wic to set the outdir to something under ${WORKDIR}.
> > > > And different images have different WORKDIR paths. So things should be
> > > > safe.
> > > >
> > > > Which branch & version of poky or oe-core are you using?
> > > >
> > >
> > > zeus
> > >
> > > > DEST_IMAGE_DIR is not defined in openembedded-core. Are you sure
> > > > that's the right variable name?
> > > >
> > >
> > > DEPLOY_DIR_IMAGE
> > >
> > > > Could you provide full bitbake output showing the exact error message
> > > > when this collision happens?
> > >
> > > See traceback here:
> > > https://ci.linaro.org/job/ledge-oe/357/DISTRO=rpb,MACHINE=ledge-stm32mp157c-dk2,label=docker-stretch-amd64/console
> >
> > I think I'm starting to understand now. Is this the wks file?
> > https://github.com/Linaro/meta-ledge/blob/zeus/meta-ledge-bsp/wic/ledge-stm32mp157c-dk2-optee.wks.in
>
> Got it. Nasty little bug there!
>
> In the rawcopy source plugin, dst is set as follows:
>
>     dst = os.path.join(cr_workdir, "%s.%s" % (source_params['file'],
> part.lineno))
>
> If source_params['file'] is an absolute path (as it is in the wks file
> above), the cr_workdir prefix is not applied by os.path.join(). So
> instead it writes to a ".1" file next to the original image - this is
> outside the WORKDIR and at risk of collision.
>
> The solution is to fix dst above, maybe use
> os.path.basename(source_params['file']). Could you give that a try or
> do you want me to propose a patch?
>
Nice!
I can test it today. Compilation will take some time...

Maxim.

> Thanks,
> Paul


  reply	other threads:[~2020-01-17 12:39 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-13 13:08 [PATCHv2] wic: fix images build in parallel Maxim Uvarov
2020-01-13 13:31 ` Paul Barker
2020-01-13 13:57   ` Maxim Uvarov
2020-01-13 14:00     ` Paul Barker
2020-01-13 14:11       ` Maxim Uvarov
2020-01-17 10:18         ` Paul Barker
2020-01-17 11:59           ` Maxim Uvarov
2020-01-17 12:17             ` Paul Barker
2020-01-17 12:27               ` Paul Barker
2020-01-17 12:39                 ` Maxim Uvarov [this message]
2020-01-17 21:26                   ` Maxim Uvarov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAD8XO3ay-B71BNHQLtkj7WhZDe5s6vhpV79aZfjmsRYGJZZNxA@mail.gmail.com \
    --to=maxim.uvarov@linaro.org \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=pbarker@konsulko.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.