Memory Leak Issue

Hi,

I am using my CoreOS just to run single container of unifi cloud controller. But I think there is a problem with my installation because the memory usage will raised over time until the server become unresponsive at all. Here is the screenshot of top memory usage:

Any idea why there is java & mongod service in my installation? I am only running this command to install docker-compose after initiating my server:

sudo rpm-ostree install docker-compose

And here is my docker-compose file content:

---
version: "2.1"
services:
  unifi-controller:
    image: linuxserver/unifi-controller
    container_name: unifi-controller
    privileged: true
    environment:
      - PUID=1000
      - PGID=1000
      - MEM_LIMIT=1024M #optional
    volumes:
      - /var/home/core/volumes/unifi-config:/config
    ports:
      - 3478:3478/udp
      - 10001:10001/udp
      - 8080:8080
      - 443:8443
      - 1900:1900/udp #optional
      - 8843:8843 #optional
      - 8880:8880 #optional
      - 6789:6789 #optional
      - 5514:5514 #optional
    restart: unless-stopped

And finally here is the content of my ignition file:

variant: fcos
version: 1.0.0
passwd:
  users:
    - name: core
      ssh_authorized_keys:
        - "ssh-ed25519 AAAA**********"
      groups: [ sudo, docker ]
storage:
  files:
    - path: /etc/hostname
      overwrite: true
      contents:
        inline: unifi

Both are most likely part of the container you are running as they are not installed in Fedora CoreOS by default. Looks like you have a memory leak issue within one of application that is being ran as part of the container. You can try to set memory limits with podman to avoid making your server unresponsive but that will might not fix the underlying issue.

I see, thank you very much for your help. I will try to add swap and report it to the image maintainer.

Setting memory limits might actually fix it - depending on configuration the JVM may not invoke the garbage collector until it starts to reach capacity. It may also not return free memory to the operating system.

Related threads: java - Does GC release back memory to OS? - Stack Overflow
JEP 346: Promptly Return Unused Committed Memory from G1 etc.

1 Like

This behavior that you have explained does not necessarily be a memory leak. Thai is actually an expected behavior for the UniFi Controller setup. The linuxserver/unifi-controller container seems to internally run both Java and MongoDB (mongod for data storage). Because of this, you will get to see these processes even though only a single container is deployed. Over time, if you notice the memory usage tends to increase because Java expands its heap based on workload. MongoDB will also be using memory for caching. Slowly over period this action will appear like a leak. However, if memory usage keeps growing without stabilizing and eventually makes the server unresponsive, then it is more likely due to insufficient memory limits or even lack of proper resource constraints. You can mitigate this by setting proper Docker memory limits, monitoring heap usage, and checking for adequate system resources. All these steps can help manage this behavior effectively. For a deeper understanding of common signs of a Java memory leak, identifying memory leaks by analyzing heap dumps, check out this blog, From Symptoms to Solutions: Troubleshooting Java Memory Leaks & OutOfMemoryError.

This topic is 5 years inactive. Let’s let is sleep :classic_smiley: Whatever conditions are described here, they are unlikely to be still applicable to a Fedora release that is still maintained.

1 Like