Zombie threads in containers - confirmation?

I'm seeing odd behavior when I run HA in a container -- something is causing zombie threads to be created. These have the same name as a thread that HA has created, but they shouldn't exist and don't seem to be doing anything.

I have posted an issue here: Duplicate (zombie) threads in container (docker) installation · Issue #174359 · home-assistant/core · GitHub

If you are running HA in a container, can you check to see if you have the same issue? If you get into a shell you can see the threads via "ps -T" or running htop (if installed).

I have seen this on a Mac running HA in Docker -- both Intel and Apple silicon. Have also seen it on an Android device under Termux and udocker. The number of zombie threads created seems to be the number of cores minus 1. That is, an 8 core system will create 7 zombies of a thread that HA created. A four core system -- only 3 zombies.

It doesn't look like HA is doing anything explicit to create these zombie threads. It looks like they might be created by something else in the system/environment.

I'm running HA container on my Pi.

Are you referring to running htop on my Pi or inside the container itself?

...what exactly am I looking for (not sure what a zombie thread looks like).


edit: In the container, I get:

HomeAssistant:/config# ps -T
PID   USER     TIME  COMMAND
    1 root      0:00 /package/admin/s6/command/s6-svscan -d4 -- /run/service
   17 root      0:00 s6-supervise s6-linux-init-shutdownd
   19 root      0:00 /package/admin/s6-linux-init/command/s6-linux-init-shutdownd -d3 -c /run/s6/basedir -g 3000 -C -B
   29 root      0:00 s6-supervise s6rc-fdholder
   30 root      0:00 s6-supervise s6rc-oneshot-runner
   38 root      0:00 /package/admin/s6/command/s6-ipcserverd -1 -- /package/admin/s6/command/s6-ipcserver-access -v0 -E -l0 -i data/rules -- /package/adm
   70 root      0:00 s6-supervise home-assistant
25999 root      7:32 python3 -m homeassistant --config /config
26004 root      0:00 {jemalloc_bg_thd} python3 -m homeassistant --config /config
26006 root      0:05 {SyncWorker_0} python3 -m homeassistant --config /config
26007 root      0:00 {jemalloc_bg_thd} python3 -m homeassistant --config /config
26008 root      0:00 {Thread-1 (_moni} python3 -m homeassistant --config /config
26009 root      0:00 {jemalloc_bg_thd} python3 -m homeassistant --config /config
26010 root      0:06 {ImportExecutor_} python3 -m homeassistant --config /config
26011 root      0:00 {jemalloc_bg_thd} python3 -m homeassistant --config /config
26014 root      0:05 {SyncWorker_1} python3 -m homeassistant --config /config
26015 root      0:06 {SyncWorker_2} python3 -m homeassistant --config /config
26016 root      0:05 {SyncWorker_3} python3 -m homeassistant --config /config
26017 root      0:05 {SyncWorker_4} python3 -m homeassistant --config /config
26018 root      0:04 {SyncWorker_5} python3 -m homeassistant --config /config
26021 root      0:06 {SyncWorker_6} python3 -m homeassistant --config /config
26022 root      0:16 {Recorder} python3 -m homeassistant --config /config
26024 root      0:00 python3 -m homeassistant --config /config
26025 root      0:00 {Thread-2 (_run_} python3 -m homeassistant --config /config
26026 root      0:00 {SyncWorker_2} python3 -m homeassistant --config /config
26027 root      0:00 {SyncWorker_2} python3 -m homeassistant --config /config
26028 root      0:00 {SyncWorker_2} python3 -m homeassistant --config /config
26029 root      0:00 {DbWorker_0} python3 -m homeassistant --config /config
26030 root      0:00 {DbWorker_1} python3 -m homeassistant --config /config
26031 root      0:00 {DbWorker_2} python3 -m homeassistant --config /config
26044 root      0:05 {SyncWorker_7} python3 -m homeassistant --config /config
26045 root      0:00 {Thread-3} python3 -m homeassistant --config /config
26047 root      0:02 {paho-mqtt-clien} python3 -m homeassistant --config /config
26048 root      0:00 python3 -m homeassistant --config /config
28113 root      0:00 {paho-mqtt-clien} python3 -m homeassistant --config /config
28877 root      0:00 {DbWorker_3} python3 -m homeassistant --config /config
26033 root      0:00 /bin/go2rtc -c /tmp/go2rtc-26qi7qhi/go2rtc_9156f5sl.yaml
26034 root      0:00 /bin/go2rtc -c /tmp/go2rtc-26qi7qhi/go2rtc_9156f5sl.yaml
26035 root      0:00 /bin/go2rtc -c /tmp/go2rtc-26qi7qhi/go2rtc_9156f5sl.yaml
26036 root      0:00 /bin/go2rtc -c /tmp/go2rtc-26qi7qhi/go2rtc_9156f5sl.yaml
26037 root      0:00 /bin/go2rtc -c /tmp/go2rtc-26qi7qhi/go2rtc_9156f5sl.yaml
26038 root      0:00 /bin/go2rtc -c /tmp/go2rtc-26qi7qhi/go2rtc_9156f5sl.yaml
26039 root      0:00 /bin/go2rtc -c /tmp/go2rtc-26qi7qhi/go2rtc_9156f5sl.yaml
26040 root      0:00 /bin/go2rtc -c /tmp/go2rtc-26qi7qhi/go2rtc_9156f5sl.yaml
26612 root      0:00 /bin/go2rtc -c /tmp/go2rtc-26qi7qhi/go2rtc_9156f5sl.yaml
28150 root      0:00 /bin/go2rtc -c /tmp/go2rtc-26qi7qhi/go2rtc_9156f5sl.yaml
29313 root      0:00 /bin/bash
29333 root      0:00 ps -T
HomeAssistant:/config# 

Thanks! Those three SyncWorker_2 threads (26026, 26027 and 26028) are what I'm calling zombies.

HA creates a pool of SyncWorker threads, but there should each have unique name SW_0, SW_1, SW_2, etc. Something is leading to the creation of zombie/duplicate threads name SyncWorker_2. As far as I can tell, there is no code in HA that would do that. Thus, there must be some system quirk that is doing this counter to any documentation.

It's great to get confirmation of the problem from a different platform!