<?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>10449</bug_id>
          
          <creation_ts>2016-10-18 08:35:37 +0000</creation_ts>
          <short_desc>tar-native - task do_populate_sysroot_setscene fails - likely race</short_desc>
          <delta_ts>2017-01-26 16:09:04 +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>core</component>
          <version>2.1.2</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</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 M2</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Jan-Simon Moeller">dl9pf</reporter>
          <assigned_to name="Ross Burton">ross.burton</assigned_to>
          <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</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>67321</commentid>
    <comment_count>0</comment_count>
    <who name="Jan-Simon Moeller">dl9pf</who>
    <bug_when>2016-10-18 08:35:37 +0000</bug_when>
    <thetext>There seems to be a race between do_populate_sysroot_setscene for tar-native and its do_populate_lic_setscene (which uses tar). 

Outcome is:

Exception: CalledProcessError: Command &apos;cd /w/workspace/ci-meta-agl-devel/repoclone/build/tmp/work/x86_64-linux/tar-native/1.28-r0/license-destdir; find . -type d -print | tar -cf - -C /w/workspace/ci-meta-agl-devel/repoclone/build/tmp/work/x86_64-linux/tar-native/1.28-r0/license-destdir -p --files-from - --no-recursion | tar -xf - -C /w/workspace/ci-meta-agl-devel/repoclone/build/tmp/deploy/licenses&apos; returned non-zero exit status 126 with output /bin/sh: /w/workspace/ci-meta-agl-devel/repoclone/build/tmp/sysroots/x86_64-linux/usr/bin/tar-native/tar: Text file busy


Look at this sequence:

NOTE: recipe tar-native-1.28-r0: task do_populate_sysroot_setscene: Started
NOTE: recipe tar-native-1.28-r0: task do_populate_lic_setscene: Started
NOTE: recipe pbzip2-native-1.1.13-r0: task do_populate_lic_setscene: Succeeded
NOTE: Running setscene task 69 of 1892 (/w/workspace/ci-meta-agl-devel/repoclone/meta-agl/meta-agl/recipes-core/packagegroups/packagegroup-core-boot-agl.bb, do_populate_lic_setscene)
NOTE: recipe qemuwrapper-cross-1.0-r0: task do_populate_sysroot_setscene: Succeeded
NOTE: Running setscene task 70 of 1892 (/w/workspace/ci-meta-agl-devel/repoclone/meta-agl/meta-agl/recipes-core/packagegroups/packagegroup-core-boot-agl.bb, do_package_qa_setscene)
ERROR: tar-native-1.28-r0 do_populate_lic_setscene: Error executing a python function in exec_python_func() autogenerated:

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:do_populate_lic_setscene(d)
     0003:
File: &apos;/w/workspace/ci-meta-agl-devel/repoclone/poky/meta/classes/license.bbclass&apos;, lineno: 664, function: do_populate_lic_setscene
     0660:
     0661:do_populate_lic_setscene[dirs] = &quot;${LICSSTATEDIR}/${PN}&quot;
     0662:do_populate_lic_setscene[cleandirs] = &quot;${LICSSTATEDIR}&quot;
     0663:python do_populate_lic_setscene () {
 *** 0664:    sstate_setscene(d)
     0665:}
     0666:addtask do_populate_lic_setscene
File: &apos;/w/workspace/ci-meta-agl-devel/repoclone/poky/meta/classes/sstate.bbclass&apos;, lineno: 648, function: sstate_setscene
     0644:            break
     0645:
     0646:def sstate_setscene(d):
     0647:    shared_state = sstate_state_fromvars(d)
 *** 0648:    accelerate = sstate_installpkg(shared_state, d)
     0649:    if not accelerate:
     0650:        raise bb.build.FuncFailed(&quot;No suitable staging package found&quot;)
     0651:
     0652:python sstate_task_prefunc () {
File: &apos;/w/workspace/ci-meta-agl-devel/repoclone/poky/meta/classes/sstate.bbclass&apos;, lineno: 320, function: sstate_installpkg
     0316:
     0317:    for state in ss[&apos;dirs&apos;]:
     0318:        prepdir(state[1])
     0319:        os.rename(sstateinst + state[0], state[1])
 *** 0320:    sstate_install(ss, d)
     0321:
     0322:    for plain in ss[&apos;plaindirs&apos;]:
     0323:        workdir = d.getVar(&apos;WORKDIR&apos;, True)
     0324:        src = sstateinst + &quot;/&quot; + plain.replace(workdir, &apos;&apos;)
File: &apos;/w/workspace/ci-meta-agl-devel/repoclone/poky/meta/classes/sstate.bbclass&apos;, lineno: 268, function: sstate_install
     0264:
     0265:    # Run the actual file install
     0266:    for state in ss[&apos;dirs&apos;]:
     0267:        if os.path.exists(state[1]):
 *** 0268:            oe.path.copyhardlinktree(state[1], state[2])
     0269:
     0270:    for postinst in (d.getVar(&apos;SSTATEPOSTINSTFUNCS&apos;, True) or &apos;&apos;).split():
     0271:        # All hooks should run in the SSTATE_INSTDIR
     0272:        bb.build.exec_func(postinst, d, (sstateinst,))
File: &apos;/w/workspace/ci-meta-agl-devel/repoclone/poky/meta/lib/oe/path.py&apos;, lineno: 81, function: copyhardlinktree
     0077:    if (os.stat(src).st_dev ==  os.stat(dst).st_dev):
     0078:        # Need to copy directories only with tar first since cp will error if two
     0079:        # writers try and create a directory at the same time
     0080:        cmd = &apos;cd %s; find . -type d -print | tar -cf - -C %s -p --files-from - --no-recursion | tar -xf - -C %s&apos; % (src, src, dst)
 *** 0081:        check_output(cmd, shell=True, stderr=subprocess.STDOUT)
     0082:        cmd = &apos;cd %s; find . -print0 | cpio --null -pdlu %s&apos; % (src, dst)
     0083:        check_output(cmd, shell=True, stderr=subprocess.STDOUT)
     0084:    else:
     0085:        copytree(src, dst)
File: &apos;/w/workspace/ci-meta-agl-devel/repoclone/poky/meta/lib/oe/path.py&apos;, lineno: 146, function: check_output
     0142:    if retcode:
     0143:        cmd = kwargs.get(&quot;args&quot;)
     0144:        if cmd is None:
     0145:            cmd = popenargs[0]
 *** 0146:        raise CalledProcessError(retcode, cmd, output=output)
     0147:    return output
     0148:
     0149:def find(dir, **walkoptions):
     0150:    &quot;&quot;&quot; Given a directory, recurses into that directory,
Exception: CalledProcessError: Command &apos;cd /w/workspace/ci-meta-agl-devel/repoclone/build/tmp/work/x86_64-linux/tar-native/1.28-r0/license-destdir; find . -type d -print | tar -cf - -C /w/workspace/ci-meta-agl-devel/repoclone/build/tmp/work/x86_64-linux/tar-native/1.28-r0/license-destdir -p --files-from - --no-recursion | tar -xf - -C /w/workspace/ci-meta-agl-devel/repoclone/build/tmp/deploy/licenses&apos; returned non-zero exit status 126 with output /bin/sh: /w/workspace/ci-meta-agl-devel/repoclone/build/tmp/sysroots/x86_64-linux/usr/bin/tar-native/tar: Text file busy
tar: -: Cannot write: Broken pipe
tar: Error is not recoverable: exiting now


WARNING: Logfile for failed setscene task is /w/workspace/ci-meta-agl-devel/repoclone/build/tmp/work/x86_64-linux/tar-native/1.28-r0/temp/log.do_populate_lic_setscene.4534
WARNING: Setscene task 49 (virtual:native:/w/workspace/ci-meta-agl-devel/repoclone/poky/meta/recipes-extended/tar/tar_1.28.bb, do_populate_lic_setscene) failed with exit code &apos;1&apos; - real task will be run instead




A solution might be to serialize the the tar task. Tar-native (sysroot-setscene) basically needs to run on its own.



Env is Ubuntu 16.04, 64bit. 8 core, 16GB with relatively slow I/O - which might trigger this. 


I&apos;m not sure if I got the syntax right ... would this solve it:


do_populate_lic_setscene[depends] = &quot;do_populate_sysroot_setscene&quot;

or is it then:

do_populate_lic_setscene_class-native[depends] = &quot;tar-native:do_populate_sysroot_setscene&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>67322</commentid>
    <comment_count>1</comment_count>
    <who name="Jan-Simon Moeller">dl9pf</who>
    <bug_when>2016-10-18 09:06:00 +0000</bug_when>
    <thetext>Note:

The issue might be *more generic* as *any* setscene tasks might fail with the

bin/tar-native/tar: Text file busy

not only tar-native:do_populate_lic_setscene is affected.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>67323</commentid>
    <comment_count>2</comment_count>
    <who name="Jan-Simon Moeller">dl9pf</who>
    <bug_when>2016-10-18 09:12:00 +0000</bug_when>
    <thetext>Found another one ...  so it&apos;s a more generic race. Tar-native should be run as single tasks with no parallel tasks at all.

ERROR: pseudo-native-1.7.5-r0 do_populate_lic_setscene: Error executing a python function in exec_python_func() autogenerated:

0150: &quot;&quot;&quot; Given a directory, recurses into that directory,
Exception: CalledProcessError: Command &apos;cd /w/workspace/ci-meta-agl/repoclone/build/tmp/work/x86_64-linux/pseudo-native/1.7.5-r0/license-destdir; find . -type d -print | tar -cf - -C /w/workspace/ci-meta-agl/repoclone/build/tmp/work/x86_64-linux/pseudo-native/1.7.5-r0/license-destdir -p --files-from - --no-recursion | tar -xf - -C /w/workspace/ci-meta-agl/repoclone/build/tmp/deploy/licenses&apos; returned non-zero exit status 126 with output /bin/sh: /w/workspace/ci-meta-agl/repoclone/build/tmp/sysroots/x86_64-linux/usr/bin/tar-native/tar: Text file busy
/bin/sh: /w/workspace/ci-meta-agl/repoclone/build/tmp/sysroots/x86_64-linux/usr/bin/tar-native/tar: Text file busy</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>70183</commentid>
    <comment_count>3</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2017-01-26 16:09:04 +0000</bug_when>
    <thetext>Recipe-specific sysroots (oe-core 809746f56df4b91af014bf6a3f28997d6698ac78) makes this impossible, marking as resolved.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>