Bug 16333 - Profiling doesn't work
Summary: Profiling doesn't work
Status: NEW
Alias: None
Product: BitBake
Classification: Build System, Metadata & Runtime
Component: bitbake (show other bugs)
Version: 6.0
Hardware: x86 Multiple
: Medium+ normal
Target Milestone: 6.2 M1
Assignee: Richard Purdie
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2026-06-25 16:21 UTC by Ross Burton
Modified: 2026-10-29 14:59 UTC (History)
3 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ross Burton 2026-06-25 16:21:24 UTC
$ bitbake -P main perl -C package
...
ERROR: Task (/home/rosbur01/Yocto/openembedded-core/meta/recipes-devtools/perl/perl_5.42.2.bb:do_package) failed with exit code '1'

The cookerlog has the actual error:

3766965 16:17:50.737188 Parsing started
Traceback (most recent call last):
  File "/home/rosbur01/Yocto/bitbake/bin/bitbake-worker", line 341, in fork_off_task
    ret = profile.Profile.runcall(prof, child)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/cProfile.py", line 109, in runcall
    self.enable()
ValueError: Another profiling tool is already active

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/rosbur01/Yocto/bitbake/bin/bitbake-worker", line 575, in <module>
    profile.Profile.runcall(prof, worker.serve)
  File "/usr/lib/python3.12/cProfile.py", line 111, in runcall
    return func(*args, **kw)
           ^^^^^^^^^^^^^^^^^
  File "/home/rosbur01/Yocto/bitbake/bin/bitbake-worker", line 439, in serve
    self.handle_item(b"runtask", self.handle_runtask)
  File "/home/rosbur01/Yocto/bitbake/bin/bitbake-worker", line 470, in handle_item
    func(self.queue[(tag_len + 4):index])
  File "/home/rosbur01/Yocto/bitbake/bin/bitbake-worker", line 520, in handle_runtask
    pid, pipein, pipeout = fork_off_task(self.cookercfg, self.data, self.databuilder, self.workerdata, self.extraconfigdata, runtask)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rosbur01/Yocto/bitbake/bin/bitbake-worker", line 344, in fork_off_task
    bb.utils.process_profilelog(profname)
  File "/home/rosbur01/Yocto/bitbake/lib/bb/utils.py", line 1482, in process_profilelog
    p = pstatopen()
        ^^^^^^^^^^^
  File "/home/rosbur01/Yocto/bitbake/lib/bb/utils.py", line 1479, in pstatopen
    return pstats.Stats(fn, stream=pout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/pstats.py", line 115, in __init__
    self.init(arg)
  File "/usr/lib/python3.12/pstats.py", line 129, in init
    self.load_stats(arg)
  File "/usr/lib/python3.12/pstats.py", line 155, in load_stats
    raise TypeError("Cannot create or construct a %r object from %r"
TypeError: Cannot create or construct a <class 'pstats.Stats'> object from 'Thu Jun 25 16:18:12 2026    profile--home-rosbur01-Yocto-openembedded-core-meta-recipes-devtools-perl-perl_5.42.2.bb-do_package.log'
Cannot create or construct a <class 'pstats.Stats'> object from 'Thu Jun 25 16:18:12 2026    profile--home-rosbur01-Yocto-openembedded-core-meta-recipes-devtools-perl-perl_5.42.2.bb-do_package.log'/home/rosbur01/Yocto/bitbake/bin/bitbake-worker:-1: ResourceWarning: unclosed file <_io.BufferedReader name=3>
Comment 1 Ross Burton 2026-06-25 16:31:33 UTC
Guessing this is the 3.12 change where profiling doesn't get disabled over threads?