Skip to contentSkip to conversation

hashserv performance issues

DISCUSSION Richard Purdie 1 participant 1 message May 22, 2024

lore
Share & tools
lore
#0 lore raw

I noticed that qemux86-world-alt builds are slow. At times it seems to sit doing nothing and I've been wondering why. Today I think I tracked down the area of the problem. Taking this one for example:

https://valkyrie.yoctoproject.org/#/builders/17/builds/10/steps/11/logs/stdio

We see sections like:

NOTE: recipe lib32-ncurses-6.5-r0: task do_install: Succeeded
NOTE: Task virtual:multilib:lib32:/home/pokybuild/yocto-worker/qemux86-world-alt/build/meta/recipes-core/util-linux/util-linux-libuuid_2.39.3.bb:do_populate_sysroot unihash changed to 425a027df360cff6d5f90787acb5f35012def9e31092b703e5ee8cfddd017217
NOTE: Task virtual:multilib:lib32:/home/pokybuild/yocto-worker/qemux86-world-alt/build/meta/recipes-extended/cracklib/cracklib_2.9.11.bb:do_populate_sysroot unihash changed to 16d675f49fadb32389099ef4c4ecd2e6ce299ae775e329daed38cc3b67fc963f
NOTE: Task virtual:multilib:lib32:/home/pokybuild/yocto-worker/qemux86-world-alt/build/meta/recipes-support/bash-completion/bash-completion_2.13.0.bb:do_populate_sysroot unihash changed to d2551c1c6abb19087cefa06275d0610f5eb13b83aa2dd09e8c1f1a2cc9d95483 Bitbake still alive (no events for 600s). Active tasks:
Bitbake still alive (no events for 1200s). Active tasks:
NOTE: Setscene tasks completed
NOTE: Running task 2801 of 37383 (/home/pokybuild/yocto-worker/qemux86-world-alt/build/meta/recipes-core/ncurses/ncurses_6.5.bb:do_populate_sysroot)
NOTE: Pressure status changed to CPU: False, IO: True, Mem: None (CPU: 1317.8/20000.0, IO: 23192.6/20000.0, Mem: 0.0/None) - using 1/16 bitbake threads
NOTE: Pressure status changed to CPU: False, IO: False, Mem: None (CPU: 1054.9/20000.0, IO: 18565.4/20000.0, Mem: 0.0/None) - using 1/16 bitbake threads
NOTE: Running task 2802 of 37383 (virtual:multilib:lib32:/home/pokybuild/yocto-worker/qemux86-world-alt/build/meta/recipes-core/ncurses/ncurses_6.5.bb:do_populate_sysroot)
NOTE: Running task 2803 of 37383 (/home/pokybuild/yocto-worker/qemux86-world-alt/build/meta/recipes-support/sqlite/sqlite3_3.45.3.bb:do_install)
NOTE: Running task 2804 of 37383 (virtual:multilib:lib32:/home/pokybuild/yocto-worker/qemux86-world-alt/build/meta/recipes-support/sqlite/sqlite3_3.45.3.bb:do_install)
NOTE: Running task 2805 of 37383 (/home/pokybuild/yocto-worker/qemux86-world-alt/build/meta/recipes-extended/pam/libpam_1.6.1.bb:do_prepare_recipe_sysroot)
NOTE: Running task 2806 of 37383 (virtual:multilib:lib32:/home/pokybuild/yocto-worker/qemux86-world-alt/build/meta/recipes-extended/pam/libpam_1.6.1.bb:do_prepare_recipe_sysroot)
NOTE: Running task 2807 of 37383 (/home/pokybuild/yocto-worker/qemux86-world-alt/build/meta/recipes-support/libpcre/libpcre2_10.43.bb:do_install)
NOTE: Running task 2808 of 37383 (virtual:multilib:lib32:/home/pokybuild/yocto-worker/qemux86-world-alt/build/meta/recipes-support/libpcre/libpcre2_10.43.bb:do_install)
NOTE: Running task 2809 of 37383 (/home/pokybuild/yocto-worker/qemux86-world-alt/build/meta/recipes-support/libcap-ng/libcap-ng_0.8.4.bb:do_compile)
NOTE: Running task 2810 of 37383 (virtual:multilib:lib32:/home/pokybuild/yocto-worker/qemux86-world-alt/build/meta/recipes-support/libcap-ng/libcap-ng_0.8.4.bb:do_compile)
NOTE: Running task 2811 of 37383 (/home/pokybuild/yocto-worker/qemux86-world-alt/build/meta/recipes-support/attr/attr_2.5.2.bb:do_prepare_recipe_sysroot)
NOTE: Running task 2812 of 37383 (virtual:multilib:lib32:/home/pokybuild/yocto-worker/qemux86-world-alt/build/meta/recipes-support/attr/attr_2.5.2.bb:do_prepare_recipe_sysroot)
NOTE: Running task 2813 of 37383 (/home/pokybuild/yocto-worker/qemux86-world-alt/build/meta/recipes-devtools/gcc/gcc-runtime_14.1.bb:do_package)
NOTE: Running task 2814 of 37383 (/home/pokybuild/yocto-worker/qemux86-world-alt/build/meta/recipes-graphics/xorg-util/util-macros_1.20.1.bb:do_prepare_recipe_sysroot)
NOTE: recipe ncurses-6.5-r0: task do_populate_sysroot: Started
NOTE: recipe sqlite3-3_3.45.3-r0: task do_install: Started

i.e. it is "rehashing" (a unihash changes) and then it stalls for 1200s. In this case there are no active tasks running. This isn't isolated, another example:

NOTE: Task virtual:multilib:lib32:/home/pokybuild/yocto-worker/qemux86-world-alt/build/meta/recipes-support/sqlite/sqlite3_3.45.3.bb:do_populate_sysroot unihash changed to ea94eb54580e74d73415cb75391bf7adc26c10b216c9730d3c5b24d2cd164d8d Bitbake still alive (no events for 600s). Active tasks:
/home/pokybuild/yocto-worker/qemux86-world-alt/build/meta/recipes-core/ncurses/ncurses_6.5.bb:do_populate_sysroot virtual:multilib:lib32:/home/pokybuild/yocto-worker/qemux86-world-alt/build/meta/recipes-core/ncurses/ncurses_6.5.bb:do_populate_sysroot /home/pokybuild/yocto-worker/qemux86-world-alt/build/meta/recipes-devtools/gcc/gcc-runtime_14.1.bb:do_package /home/pokybuild/yocto-worker/qemux86-world-alt/build/meta/recipes-extended/pam/libpam_1.6.1.bb:do_configure /home/pokybuild/yocto-worker/qemux86-world-alt/build/meta/recipes-support/libpcre/libpcre2_10.43.bb:do_populate_sysroot virtual:multilib:lib32:/home/pokybuild/yocto-worker/qemux86-world-alt/build/meta/recipes-extended/pam/libpam_1.6.1.bb:do_configure virtual:multilib:lib32:/home/pokybuild/yocto-worker/qemux86-world-alt/build/meta/recipes-support/libpcre/libpcre2_10.43.bb:do_populate_sysroot /home/pokybuild/yocto-worker/qemux86-world-alt/build/meta/recipes-support/libcap-ng/libcap-ng_0.8.4.bb:do_populate_sysroot virtual:multilib:lib32:/home/pokybuild/yocto-worker/qemux86-world-alt/build/meta/recipes-support/libcap-ng/libcap-ng_0.8.4.bb:do_populate_sysroot /home/pokybuild/yocto-worker/qemux86-world-alt/build/meta/recipes-graphics/xorg-proto/xorgproto_2024.1.bb:do_populate_sysroot /home/pokybuild/yocto-worker/qemux86-world-alt/build/meta/recipes-graphics/xorg-util/util-macros_1.20.1.bb:do_populate_sysroot /home/pokybuild/yocto-worker/qemux86-world-alt/build/meta/recipes-support/attr/attr_2.5.2.bb:do_compile virtual:multilib:lib32:/home/pokybuild/yocto-worker/qemux86-world-alt/build/meta/recipes-support/attr/attr_2.5.2.bb:do_compile virtual:multilib:lib32:/home/pokybuild/yocto-worker/qemux86-world-alt/build/meta/recipes-devtools/gcc/gcc-runtime_14.1.bb:do_package
Bitbake still alive (no events for 1200s). Active tasks:
/home/pokybuild/yocto-worker/qemux86-world-alt/build/meta/recipes-core/ncurses/ncurses_6.5.bb:do_populate_sysroot virtual:multilib:lib32:/home/pokybuild/yocto-worker/qemux86-world-alt/build/meta/recipes-core/ncurses/ncurses_6.5.bb:do_populate_sysroot /home/pokybuild/yocto-worker/qemux86-world-alt/build/meta/recipes-devtools/gcc/gcc-runtime_14.1.bb:do_package /home/pokybuild/yocto-worker/qemux86-world-alt/build/meta/recipes-extended/pam/libpam_1.6.1.bb:do_configure /home/pokybuild/yocto-worker/qemux86-world-alt/build/meta/recipes-support/libpcre/libpcre2_10.43.bb:do_populate_sysroot virtual:multilib:lib32:/home/pokybuild/yocto-worker/qemux86-world-alt/build/meta/recipes-extended/pam/libpam_1.6.1.bb:do_configure virtual:multilib:lib32:/home/pokybuild/yocto-worker/qemux86-world-alt/build/meta/recipes-support/libpcre/libpcre2_10.43.bb:do_populate_sysroot /home/pokybuild/yocto-worker/qemux86-world-alt/build/meta/recipes-support/libcap-ng/libcap-ng_0.8.4.bb:do_populate_sysroot virtual:multilib:lib32:/home/pokybuild/yocto-worker/qemux86-world-alt/build/meta/recipes-support/libcap-ng/libcap-ng_0.8.4.bb:do_populate_sysroot /home/pokybuild/yocto-worker/qemux86-world-alt/build/meta/recipes-graphics/xorg-proto/xorgproto_2024.1.bb:do_populate_sysroot /home/pokybuild/yocto-worker/qemux86-world-alt/build/meta/recipes-graphics/xorg-util/util-macros_1.20.1.bb:do_populate_sysroot /home/pokybuild/yocto-worker/qemux86-world-alt/build/meta/recipes-support/attr/attr_2.5.2.bb:do_compile virtual:multilib:lib32:/home/pokybuild/yocto-worker/qemux86-world-alt/build/meta/recipes-support/attr/attr_2.5.2.bb:do_compile virtual:multilib:lib32:/home/pokybuild/yocto-worker/qemux86-world-alt/build/meta/recipes-devtools/gcc/gcc-runtime_14.1.bb:do_package

in this case, again there is a rehash and this time there are active tasks running but it stalls for over 1200s.

I was able to login and connect gdb to get a python backtrace, the useful piece of which was:

Traceback (most recent call first):
File "/usr/lib/python3.10/selectors.py", line 469, in select
fd_event_list = self._selector.poll(timeout, max_ev)
File "/usr/lib/python3.10/asyncio/base_events.py", line 1871, in _run_once
event_list = self._selector.select(timeout)
File "/usr/lib/python3.10/asyncio/base_events.py", line 603, in run_forever

    self._run_once()
  File "/usr/lib/python3.10/asyncio/base_events.py", line 636, in run_until_complete
    self.run_forever()
  File "/home/pokybuild/yocto-worker/qemux86-world-alt/build/bitbake/lib/bb/asyncrpc/client.py", line 225, in wrapper
    return self.loop.run_until_complete(downcall(*args, **kwargs))
  File "/home/pokybuild/yocto-worker/qemux86-world-alt/build/bitbake/lib/bb/siggen.py", line 732, in get_unihashes
    query_result[tid] = client.get_unihash(*args)
  File "/home/pokybuild/yocto-worker/qemux86-world-alt/build/bitbake/lib/bb/siggen.py", line 707, in get_unihash
    return self.get_unihashes([tid])[tid]
  File "/home/pokybuild/yocto-worker/qemux86-world-alt/build/bitbake/lib/bb/runqueue.py", line 2570, in process_possible_migrations
    newuni = bb.parse.siggen.get_unihash(tid)
  File "/home/pokybuild/yocto-worker/qemux86-world-alt/build/bitbake/lib/bb/runqueue.py", line 2173, in execute
    self.process_possible_migrations()
  File "/home/pokybuild/yocto-worker/qemux86-world-alt/build/bitbake/lib/bb/runqueue.py", line 1603, in _execute_runqueue
    retval = self.rqexe.execute()
  File "/home/pokybuild/yocto-worker/qemux86-world-alt/build/bitbake/lib/bb/runqueue.py", line 1637, in execute_runqueue
    return self._execute_runqueue()
  File "/home/pokybuild/yocto-worker/qemux86-world-alt/build/bitbake/lib/bb/cooker.py", line 1488, in buildTargetsIdle
    retval = rq.execute_runqueue()
  File "/home/pokybuild/yocto-worker/qemux86-world-alt/build/bitbake/lib/bb/server/process.py", line 435, in idle_thread_internal
    retval = function(self, data, False)
  File "/home/pokybuild/yocto-worker/qemux86-world-alt/build/bitbake/lib/bb/server/process.py", line 418, in idle_thread
    self.idle_thread_internal()
  File "/usr/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()

File "/usr/lib/python3.10/threading.py", line 973, in _bootstrap
self._bootstrap_inner()

i.e. it is looping in process_possible_migrations() in runqueue.py and stalling on the get_unihash() calls.

I put a patch on master-next which batches those up into a block get_unihashes() call but when trying to test that, I noticed this:

https://valkyrie.yoctoproject.org/#/builders/17/builds/13

Initialising tasks...Bitbake still alive (no events for 600s). Active tasks:
Bitbake still alive (no events for 1200s). Active tasks:

i.e. we have the same issue at runqueue init time, it shouldn't take over 1200s there.

This suggests that there could be something wrong with the hash server making it very slow, or the geo round trip time to the server is poor, or something else is going wrong with the hash server performance.

I thought I'd share the findings so far in case someone can make sense of what is going on.

Cheers,

Richard