Skip to content

Possible memory leak?  #133

@MasterGroosha

Description

@MasterGroosha

Describe the bug

I'm running WriteFreely v 0.9.1 on my Scaleway instance with 2GB of RAM. It's a single-user federated instance with SQLite as backend. I'm managing it via systemd with the following service description:

[Unit]
Description=Write Freely Instance
After=syslog.target network.target

[Service]
Type=simple
WorkingDirectory=/home/groosha/writefreely
ExecStart=/home/groosha/writefreely/writefreely >> /var/log/writefreely.log
Restart=always

[Install]
WantedBy=multi-user.target

The only modification I made is replacing one of "letter-avatars" with a custom one to see a proper profile pic on Mastodon.

Symptoms

If I run WriteFreely for a long time (let's say, a month) without even touching it (no users, no new posts, nothing), it consumes almost all free RAM on server, causing other apps to have problems.
For example, my Python scripts which are running as cron jobs and regular processes, raise some exceptions like RuntimeError: can't start new thread or vedis.cpython-35m-x86_64-linux-gnu.so: failed to map segment from shared object. Also running htop shows that writefreely process consumes ~60% of RAM:
изображение
(notice that I'm running only one process, but htop shows all threads)

After I restart writefreely with systemctl restart writefreely everything gets back to normal:
изображение
(here I enabled "tree" view of processes, showing that I have only 1 process of writefreely and others are most likely threads)

My bad I didn't write down Go internal stats from /admin page, I guess it would help a lot.

Expected behavior

RAM usage should depend on active users or API usage, not increase as the time goes by.

Application configuration

  • Single mode or Multi-user mode? Single mode
  • Database? SQLite
  • Open registration? No
  • Federation enabled? Yes
  • Operating system? Ubuntu 16.10 (oops!)

Version or last commit: 0.9.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions