<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>12070</bug_id>
          
          <creation_ts>2017-09-08 22:26:16 +0000</creation_ts>
          <short_desc>Race condition for do_image_complete due to do_populate_lic task not completed for EXTRA_IMAGEDEPENDS and EFI_PROVIDER</short_desc>
          <delta_ts>2018-08-05 19:24:25 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>deployment</component>
          <version>2.3.2</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WONTFIX</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>major</bug_severity>
          <target_milestone>2.3.5</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="olivierthomas.j">olivierthomas.j</reporter>
          <assigned_to name="Armin Kuster">akuster</assigned_to>
          <cc>akuster</cc>
    
    <cc>dl9pf</cc>
    
    <cc>gauragup</cc>
    
    <cc>randy.macleod</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>76707</commentid>
    <comment_count>0</comment_count>
    <who name="olivierthomas.j">olivierthomas.j</who>
    <bug_when>2017-09-08 22:26:16 +0000</bug_when>
    <thetext>I observed a consistent race condition on slow running machines, when &quot;EXTRA_IMAGEDEPENDS&quot; and &quot;EFI_PROVIDER&quot; is used.

In meta/classes/image.bbclass only the &quot;do_populate_sysroot&quot; task is added as a dependency to &quot;do_image_complete&quot; for all &quot;EXTRA_IMAGEDEPENDS&quot;:
deps = &quot;&quot;
    for dep in (d.getVar(&apos;EXTRA_IMAGEDEPENDS&apos;) or &quot;&quot;).split():
        deps += &quot; %s:do_populate_sysroot&quot; % dep
    d.appendVarFlag(&apos;do_image_complete&apos;, &apos;depends&apos;, deps)

In meta/classes/grub-efi.bbclass (this could very well be any EFI_PROVIDER) the &quot;do_deploy&quot; task is added as a dependency to &quot;do_bootimg&quot;:
do_bootimg[depends] += &quot;${MLPREFIX}grub-efi:do_deploy&quot;

and in meta/classes/license.bbclass we include all dependencies from &quot;EXTRA_IMAGEDEPENDS&quot; and do_bootimg[depends] for manifest deployment:
def get_deployed_dependencies(d):
    &quot;&quot;&quot;
    Get all the deployed dependencies of an image
    &quot;&quot;&quot;

    deploy = {}
    # Get all the dependencies for the current task (rootfs).
    # Also get EXTRA_IMAGEDEPENDS because the bootloader is
    # usually in this var and not listed in rootfs.
    # At last, get the dependencies from boot classes because
    # it might contain the bootloader.
    taskdata = d.getVar(&quot;BB_TASKDEPDATA&quot;, False)
    depends = list(set([dep[0] for dep
                    in list(taskdata.values())
                    if not dep[0].endswith(&quot;-native&quot;)]))
    extra_depends = d.getVar(&quot;EXTRA_IMAGEDEPENDS&quot;)
    boot_depends = get_boot_dependencies(d)
    depends.extend(extra_depends.split())
    depends.extend(boot_depends)
    depends = list(set(depends))

To summarize:
1. IMAGE_POSTPROCESS_COMMAND_prepend = &quot;write_deploy_manifest; is called after do_image_complete
   Call order: write_deploy_manifest -&gt; license_deployed_manifest -&gt; get_deployed_dependencies
2. get_deployed_dependencies includes:
   &quot;EXTRA_IMAGEDEPENDS&quot; and grub-efi as dependencies for write_deploy_manifest
3. do_image_complete does not depend on EXTRA_IMAGEDEPENDS do_populate_lic task, so it fails to find the files since the task has not been completed (EXTRA_IMAGEDEPENDS = &quot;qemu-native qemu-helper-native ovmf&quot;):

The stack trace of python calls that resulted in this exception/failure was:
File: &apos;exec_python_func() autogenerated&apos;, lineno: 2, function: &lt;module&gt;
     0001:
 *** 0002:write_deploy_manifest(d)
     0003:
NOTE: recipe eudev-3.2.1-r0: task do_package_qa: Started
File: &apos;/data/build-dir/SANDBOX-VDYOCTO10-JOB1/poky/meta/classes/license.bbclass&apos;, lineno: 33, function: write_deploy_manifest
     0029:        &apos;w+&apos;).write(output)
     0030:}
     0031:
     0032:python write_deploy_manifest() {
 *** 0033:    license_deployed_manifest(d)
     0034:}
     0035:
     0036:python license_create_manifest() {
     0037:    import oe.packagedata
File: &apos;/data/build-dir/SANDBOX-VDYOCTO10-JOB1/poky/meta/classes/license.bbclass&apos;, lineno: 192, function: license_deployed_manifest
     0188:        man_dic[dep][&quot;IMAGE_MANIFEST&quot;] = True
     0189:        man_dic[dep][&quot;PN&quot;] = dep
     0190:        man_dic[dep][&quot;FILES&quot;] = \
     0191:            &quot; &quot;.join(get_deployed_files(dep_dic[dep]))
 *** 0192:        with open(os.path.join(lic_dir, dep, &quot;recipeinfo&quot;), &quot;r&quot;) as f:
     0193:            for line in f.readlines():
     0194:                key,val = line.split(&quot;: &quot;, 1)
     0195:                man_dic[dep][key] = val[:-1]
     0196:
Exception: FileNotFoundError: [Errno 2] No such file or directory: &apos;/data/build-dir/SANDBOX-VDYOCTO10-JOB1/poky/build/odm/tmp/deploy/licenses/ovmf/recipeinfo

4. do_image_complete does not depend on grub-efi do_populate_lic task, so it fails to find the files since the task has not been completed:

The stack trace of python calls that resulted in this exception/failure was:
File: &apos;exec_python_func() autogenerated&apos;, lineno: 2, function: &lt;module&gt;
     0001:
 *** 0002:write_deploy_manifest(d)
     0003:
File: &apos;/data/build-dir/SANDBOX-VDYOCTO10-JOB1/poky/meta/classes/license.bbclass&apos;, lineno: 33, function: write_deploy_manifest
     0029:        &apos;w+&apos;).write(output)
     0030:}
     0031:
     0032:python write_deploy_manifest() {
 *** 0033:    license_deployed_manifest(d)
     0034:}
     0035:
     0036:python license_create_manifest() {
     0037:    import oe.packagedata
File: &apos;/data/build-dir/SANDBOX-VDYOCTO10-JOB1/poky/meta/classes/license.bbclass&apos;, lineno: 192, function: license_deployed_manifest
     0188:        man_dic[dep][&quot;IMAGE_MANIFEST&quot;] = True
     0189:        man_dic[dep][&quot;PN&quot;] = dep
     0190:        man_dic[dep][&quot;FILES&quot;] = \
     0191:            &quot; &quot;.join(get_deployed_files(dep_dic[dep]))
 *** 0192:        with open(os.path.join(lic_dir, dep, &quot;recipeinfo&quot;), &quot;r&quot;) as f:
     0193:            for line in f.readlines():
     0194:                key,val = line.split(&quot;: &quot;, 1)
     0195:                man_dic[dep][key] = val[:-1]
     0196:
Exception: FileNotFoundError: [Errno 2] No such file or directory: &apos;/data/build-dir/SANDBOX-VDYOCTO10-JOB1/poky/build/odm/tmp/deploy/licenses/grub-efi/recipeinfo&apos;

This may be split up into two bugs, one for grub-efi and EXTRA_IMAGEDEPENDS.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>76953</commentid>
    <comment_count>1</comment_count>
    <who name="Armin Kuster">akuster</who>
    <bug_when>2017-09-18 23:26:34 +0000</bug_when>
    <thetext>Oliver,

Have you tried this scenario against Master?
How often does this occur?
Is there a test case or scenario that will help me reproduce this.
Host info and local.conf may be helpful.

By slow machine, can you define that?

- armin</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>77017</commentid>
    <comment_count>2</comment_count>
    <who name="Stephen K Jolley">sjolley.yp.pm</who>
    <bug_when>2017-09-21 14:35:46 +0000</bug_when>
    <thetext>Please review and answer the question.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>77598</commentid>
    <comment_count>3</comment_count>
    <who name="Jan-Simon Moeller">dl9pf</who>
    <bug_when>2017-10-15 06:48:58 +0000</bug_when>
    <thetext>Here it happens on pyro.

For me slow manchine means 8 core 16G ram but quite slow i/o . Happens quite reliably e.g.

ovmf:
https://build.automotivelinux.org/view/jjb-release-jobs/job/release-jjb-eel-snapshot/MACHINE=intel-corei7-64,label=agl-test-slave/7/consoleFull

But also with other packages, e.g.: 
systemd-boot - 
https://build.automotivelinux.org/view/jjb-release-jobs/job/release-jjb-eel-snapshot/MACHINE=intel-corei7-64,label=agl-test-slave/6/console

rmc-db - 
https://build.automotivelinux.org/view/jjb-release-jobs/job/release-jjb-eel-snapshot/MACHINE=intel-corei7-64,label=agl-test-slave/5/console


Interestingly it only fails on builds with meta-intel for me. Six other builds from the same set complete w/o issues.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>77600</commentid>
    <comment_count>4</comment_count>
    <who name="Jan-Simon Moeller">dl9pf</who>
    <bug_when>2017-10-15 21:08:59 +0000</bug_when>
    <thetext>Correction: it turns out that with PARALLEL_MAKE and BB_NUMBER_THREADS both set to 1  the problem is reproducible on all machines.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>77601</commentid>
    <comment_count>5</comment_count>
    <who name="Armin Kuster">akuster</who>
    <bug_when>2017-10-15 21:24:08 +0000</bug_when>
    <thetext>(In reply to comment #4)
&gt; Correction: it turns out that with PARALLEL_MAKE and BB_NUMBER_THREADS both
&gt; set to 1  the problem is reproducible on all machines.

Perfect. Thanks Jan</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>77613</commentid>
    <comment_count>6</comment_count>
    <who name="Jan-Simon Moeller">dl9pf</who>
    <bug_when>2017-10-16 19:10:59 +0000</bug_when>
    <thetext>http://lists.openembedded.org/pipermail/openembedded-core/2017-September/142760.html 

might be a solution.

@Armin: could you consider that for pyro ?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>77631</commentid>
    <comment_count>7</comment_count>
    <who name="Jan-Simon Moeller">dl9pf</who>
    <bug_when>2017-10-17 08:58:09 +0000</bug_when>
    <thetext>As temp solution in my local.conf I used

do_image_complete[deptask] += &quot;do_populate_lic&quot; 

and the builds went through finally.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>78871</commentid>
    <comment_count>8</comment_count>
    <who name="Gaurav Gupta">gauragup</who>
    <bug_when>2018-01-02 21:31:15 +0000</bug_when>
    <thetext>Fix/Change in Comment#6 solves the EXTRA_IMAGEDEPENDS issue but the grub-efi issue is still there. Temp solution given by Jan-Simon is able to make it go past the grub-efi issue.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>81247</commentid>
    <comment_count>9</comment_count>
    <who name="Armin Kuster">akuster</who>
    <bug_when>2018-08-05 19:24:25 +0000</bug_when>
    <thetext>At this time we will stick with the work around.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>