<?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>15957</bug_id>
          
          <creation_ts>2025-08-21 06:53:04 +0000</creation_ts>
          <short_desc>AB-INT: importlib deadlock issue on older python versions</short_desc>
          <delta_ts>2026-10-15 14:57:47 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>10</classification_id>
          <classification>QA/Testing</classification>
          <product>Functional (self) Testing</product>
          <component>oe-selftest</component>
          <version>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          <see_also>https://bugzilla.yoctoproject.org/show_bug.cgi?id=16453</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard>AB-INT</status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>6.1</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Mathieu Dubois-Briand">mathieu.dubois-briand</reporter>
          <assigned_to name="Unassigned">unassigned</assigned_to>
          <cc>antonin.godard</cc>
    
    <cc>JPEWhacker</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>richard.purdie</cc>
    
    <cc>yoann.congal</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>102633</commentid>
    <comment_count>0</comment_count>
    <who name="Mathieu Dubois-Briand">mathieu.dubois-briand</who>
    <bug_when>2025-08-21 06:53:04 +0000</bug_when>
    <thetext>I&apos;m not really sure how to understand this failure and what is the root cause here.

First we have:

     75 2025-08-17 01:29:52,082 - oe-selftest - INFO - testtools.testresult.real._StringException: Traceback (most recent call last):
     76   File &quot;/srv/pokybuild/yocto-worker/qemuarm64-tc/build/meta/lib/oeqa/core/case.py&quot;, line 40, in _oeSetUpClass
     77     clss.setUpClassMethod()
     78   File &quot;/srv/pokybuild/yocto-worker/qemuarm64-tc/build/meta/lib/oeqa/selftest/cases/meta_ide.py&quot;, line 23, in setUpClass
     79     bb_vars = get_bb_vars([&apos;MACHINE_ARCH&apos;, &apos;TARGET_VENDOR&apos;, &apos;TARGET_OS&apos;, &apos;DEPLOY_DIR_IMAGE&apos;, &apos;COREBASE&apos;])
     80   File &quot;/srv/pokybuild/yocto-worker/qemuarm64-tc/build/meta/lib/oeqa/utils/commands.py&quot;, line 250, in get_bb_vars
     81     bbenv = get_bb_env(target, postconfig=postconfig)
     82   File &quot;/srv/pokybuild/yocto-worker/qemuarm64-tc/build/meta/lib/oeqa/utils/commands.py&quot;, line 246, in get_bb_env
     83     return bitbake(&quot;-e&quot;, postconfig=postconfig).output
     84   File &quot;/srv/pokybuild/yocto-worker/qemuarm64-tc/build/meta/lib/oeqa/utils/commands.py&quot;, line 236, in bitbake
     85     return runCmd(cmd, ignore_status, timeout, output_log=output_log, **options)
     86   File &quot;/srv/pokybuild/yocto-worker/qemuarm64-tc/build/meta/lib/oeqa/utils/commands.py&quot;, line 214, in runCmd
     87     raise AssertionError(&quot;Command &apos;%s&apos; returned non-zero exit status %d:\n%s&quot; % (command, result.status, exc_output))
     88 AssertionError: Command &apos;bitbake  -e&apos; returned non-zero exit status 1:
     89 NOTE: Reconnecting to bitbake server...
     90 ERROR: Unable to parse &lt;frozen importlib._bootstrap&gt;
     91 Traceback (most recent call last):
     92   File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 1024, in _find_and_load
     93   File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 171, in __enter__
     94   File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 123, in acquire
     95 KeyError: 140462603003456

But we also have this, later in the log:

    105 Exception in thread Thread-13 (_run_test):
    106 Traceback (most recent call last):
    107   File &quot;/srv/pokybuild/yocto-worker/qemuarm64-tc/build/meta/lib/oeqa/core/utils/concurrencytest.py&quot;, line 234, in _run_test
    108     testserver.run(process_result)
    109   File &quot;/usr/lib/python3/dist-packages/subunit/__init__.py&quot;, line 1197, in run
    110     protocol.lineReceived(line)
    111   File &quot;/usr/lib/python3/dist-packages/subunit/__init__.py&quot;, line 567, in lineReceived
    112     self._state.lineReceived(line)
    113   File &quot;/usr/lib/python3/dist-packages/subunit/__init__.py&quot;, line 404, in lineReceived
    114     self.details_parser.lineReceived(line)
    115   File &quot;/usr/lib/python3/dist-packages/subunit/details.py&quot;, line 42, in lineReceived
    116     self._state.endDetails()
    117   File &quot;/usr/lib/python3/dist-packages/subunit/__init__.py&quot;, line 400, in endDetails
    118     self.parser.client.stopTest(self.parser._current_test)
    119   File &quot;/usr/lib/python3/dist-packages/testtools/testresult/real.py&quot;, line 1537, in stopTest
    120     return self.decorated.stopTest(test)
    121   File &quot;/usr/lib/python3/dist-packages/testtools/testresult/real.py&quot;, line 232, in stopTest
    122     super().stopTest(test)
    123   File &quot;/usr/lib/python3.10/unittest/result.py&quot;, line 80, in stopTest
    124     self._restoreStdout()
    125   File &quot;/usr/lib/python3.10/unittest/result.py&quot;, line 99, in _restoreStdout
    126     self._stdout_buffer.seek(0)
    127 AttributeError: &apos;NoneType&apos; object has no attribute &apos;seek&apos;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102636</commentid>
    <comment_count>1</comment_count>
    <who name="Mathieu Dubois-Briand">mathieu.dubois-briand</who>
    <bug_when>2025-08-21 06:55:22 +0000</bug_when>
    <thetext>qemuarm64-tc ubuntu2204-vk-1 master completed at 2025-08-17 11:34:38+00:00
https://autobuilder.yoctoproject.org/valkyrie/#/builders/5/builds/2140/steps/12/logs/stdio</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102646</commentid>
    <comment_count>2</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2025-08-21 14:44:16 +0000</bug_when>
    <thetext>Richard thinks that this is a python bug in ubu-22.04 that has been fixed in newer versions of python. 

Monitor for now,

The main error is the KeyError</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>105232</commentid>
    <comment_count>3</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2026-04-23 15:17:34 +0000</bug_when>
    <thetext>Has&apos;t happen. Might be fixed by weekly builder distro updates.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>105668</commentid>
    <comment_count>4</comment_count>
    <who name="Joshua Watt">JPEWhacker</who>
    <bug_when>2026-05-28 19:50:03 +0000</bug_when>
    <thetext>This was seen again in https://bugzilla.yoctoproject.org/show_bug.cgi?id=16296 (which is now closed as a duplicate of this bug).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>105670</commentid>
    <comment_count>5</comment_count>
    <who name="Joshua Watt">JPEWhacker</who>
    <bug_when>2026-05-28 19:50:56 +0000</bug_when>
    <thetext>*** Bug 16296 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>106052</commentid>
    <comment_count>6</comment_count>
    <who name="Yoann Congal">yoann.congal</who>
    <bug_when>2026-06-30 21:33:26 +0000</bug_when>
    <thetext>oe-selftest-debian debian11-vk-1 scarthgap completed at 2026-06-30 18:59:51+00:00
https://autobuilder.yoctoproject.org/valkyrie/?#/builders/35/builds/4176

 $ ssh debian11-vk-1.yocto.io python3 --version
Python 3.9.2

I think the upstream bug is &quot;importlib lock race issue in deadlock handling code&quot; · Issue #91351 · python/cpython
https://github.com/python/cpython/issues/91351
=&gt; Linked PR:
gh-91351: Fix some bugs in importlib handling of re-entrant imports by exarkun · Pull Request #94504 · python/cpython
https://github.com/python/cpython/pull/94504

=&gt; Merge commit:
gh-91351: Fix some bugs in importlib handling of re-entrant imports (… · python/cpython@3325f05
https://github.com/python/cpython/commit/3325f054e33b318aa56b74472f76a56b8afc0510

=&gt; in python &gt;= 3.12

Note: I&apos;ve created #16335 &quot;Create more fine-grained buildtools&quot;, with the idea of creating a buildtool-python3 to install a fixed python where host python3 has this bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>106053</commentid>
    <comment_count>7</comment_count>
    <who name="Yoann Congal">yoann.congal</who>
    <bug_when>2026-06-30 21:39:19 +0000</bug_when>
    <thetext>Looking through https://errors.yoctoproject.org/Errors/Search/?query=frozen+importlib._bootstrap, I found others instances:
oe-selftest-fedora stream9-vk-1 scarthgap completed at 2026-06-24 13:17:33+00:00
https://autobuilder.yoctoproject.org/valkyrie/?#/builders/48/builds/3965/steps/15/logs/stdio
oe-selftest-debian ubuntu2204-vk-1 scarthgap completed at 2026-04-07 00:36:39+00:00
https://autobuilder.yoctoproject.org/valkyrie/#/builders/35/builds/3612/steps/15/logs/stdio
oe-selftest-debian debian11-vk-1 whinlatter completed at 2026-03-29 11:53:50+00:00
https://autobuilder.yoctoproject.org/valkyrie/#/builders/35/builds/3545/steps/15/logs/stdio

Note: the link to this bug is not easy to notice because the reported error appears later and is not always the same.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>