question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Resetting hci0 in Docker container is causing zombie processes

See original GitHub issue

Describe the bug I am getting a lot of zombie processes popping up as a result of my room-assistant Docker container. It appears as though whenever the BluetoothClassicService query takes too long and hci0 is reset, it becomes a zombie process. This results in tons of zombie processes over time until I restart the room-assistant container, at which point they all are destroyed.

This issue is specifically impacting my deployment on my Intel NUC and is not occurring on my Raspberry Pi deploys.

To reproduce Deploy using the docker-compose file and config below.

Relevant logs

Room Assistant logs.

docker logs -f room-assistant

[Nest] 1   - 03/22/2020, 11:44:54 AM   [BluetoothClassicService] Query of xx:xx:xx:xx:xx:xx took too long, resetting hci0
[Nest] 1   - 03/22/2020, 11:46:24 AM   [BluetoothClassicService] Query of xx:xx:xx:xx:xx:xx took too long, resetting hci0
[Nest] 1   - 03/22/2020, 11:46:35 AM   [BluetoothClassicService] Query of xx:xx:xx:xx:xx:xx took too long, resetting hci0
[Nest] 1   - 03/22/2020, 11:46:36 AM   [BluetoothClassicService] Query of xx:xx:xx:xx:xx:xx took too long, resetting hci0
[Nest] 1   - 03/22/2020, 11:55:06 AM   [BluetoothClassicService] Query of xx:xx:xx:xx:xx:xx took too long, resetting hci0

Zombie processes.

user@core:~$ ps auxwww | grep ' Z '
4 Z root      5859 28012  0  80   0 -     0 -      13:44 ?        00:00:00 [hcitool] <defunct>
4 Z root      7486 28012  0  80   0 -     0 -      13:46 ?        00:00:00 [hcitool] <defunct>
4 Z root      7672 28012  0  80   0 -     0 -      13:46 ?        00:00:00 [hcitool] <defunct>
4 Z root      7713 28012  0  80   0 -     0 -      13:46 ?        00:00:00 [hcitool] <defunct>

Relevant configuration

Docker Compose docker-compose.yaml

version: "3.1"
services:

  # Room Assistant-----------------------------------
  room-assistant:
    container_name: room-assistant
    image: mkerix/room-assistant
    network_mode: host
    ports:
      - 6425:6425
    cap_add:
      - NET_ADMIN
    volumes:
      - /var/run/dbus:/var/run/dbus
      - ./room-assistant/config:/room-assistant/config
      - /etc/localtime:/etc/localtime:ro
    restart: always

Room Assistant config local.yml

global:
  instanceName: office
  integrations:
    - homeAssistant
    - bluetoothClassic
homeAssistant:
  mqttUrl: 'mqtt://XXX.XXX.XXX.XXX:1883'
  mqttOptions:
    username: <username>
    password: <password>
cluster:
  networkInterface: eno1
  port: 6425
  peerAddresses:
    - <raspberry_pi_zero_1>:6425 
    - <raspberry_pi_zero_1>:6425
bluetoothClassic:
  addresses:
    - '<mac_address_1>'
    - '<mac_address_2>' 

Expected behavior I expect the zombie processes to not appear.

Environment

  • room-assistant version: 2.1.1
  • installation type: Docker
  • hardware: Intel NUC8i5BEK1
  • OS: Ubuntu 18.04.4 LTS (GNU/Linux 4.15.0-91-generic x86_64)

Additional context

Zombie processes are not appearing on both Raspberry Pis that have room-assistant installed.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mKeRixcommented, Apr 13, 2020

Thanks for checking that already @iicky - saved me some work. I reproduced the issue on a Raspi 3 with Docker today and found a fix. Expect it to be released sometime later today.

The issue arose due to the way Docker manages processes, or rather that NodeJS wasn’t made to be PID 1. There is some more information in this article.

1reaction
iickycommented, Apr 12, 2020

I tried out a Debian image using the following Dockerfile and I am still getting the same zombie processes. I did my best to find matching or similar packages so I’m not 100% sure the image is a complete Debian replacement, but I can confirm that the zombie processes are still appearing with Debian.

FROM node:12-slim as build
ARG ROOM_ASSISTANT_VERSION=latest

RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y python g++ make libusb-dev avahi-utils libavahi-compat-libdnssd-dev

RUN npm install -g --unsafe-perm room-assistant@$ROOM_ASSISTANT_VERSION

FROM node:12-slim

WORKDIR /room-assistant

RUN apt-get update && apt-get install -y bluez libusb-dev avahi-utils dmidecode libavahi-compat-libdnssd1

RUN ln -s /usr/local/lib/node_modules/room-assistant/bin/room-assistant.js /usr/local/bin/room-assistant
COPY --from=build /usr/local/lib/node_modules/room-assistant /usr/local/lib/node_modules/room-assistant

ENTRYPOINT ["room-assistant"]
CMD ["--digResolver"]
Read more comments on GitHub >

github_iconTop Results From Across the Web

Docker and the PID 1 zombie reaping problem - Phusion Blog
This init process is responsible for starting the rest of the system, such as starting the SSH daemon, starting the Docker daemon, starting ......
Read more >
Zombie processes when running in Docker - Google Groups
When running in Docker PID 1 is the Exhibitor process, and not the init system, which causes the Zookeeper process to not be...
Read more >
Xiaomi Mijia bluetooth temperature & humidity sensor ...
I'm interested in adding temperature and humidity sensors ... I noticed that restarting from the web interface spawns zombie processes (I do ...
Read more >
Docker - init, zombies - why does it matter? - Stack Overflow
The init process then becomes the zombies parent and they can be cleaned up. Next, a container is a cgroup of processes running...
Read more >
lXo - River Thames Conditions - Environment Agency - GOV.UK
Annie anthonio album, Horrible things caught on tape, Home and away 6121 full ... Pulau giam pangkor island, Sfsg selection process, Pokeawesome script, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found