Server crashes possibly because of memory leak

Description

Hello, our company is hosting a single instance of Rocket.Chat server for approximately 50 active users, on a DigitalOcean droplet (2 vCPUs, 4GB memory, 50GB SSD). According to the mimimum requirements page on the documentation, this is more than enough for our needs. Nevertheless we often (every two days approximately) experience what seems to be a memory saturation leading to a server freeze. We then need to hard-reboot the server to get the instance running again. We assume that this is due to image upload, or a too high number of simultaneous connections, but we don’t know for sure.

Here are some metrics from after the latest crash:

We have several questions:

  • Is it a “normal” behaviour? Aren’t there safety locks meant to prevent such an extreme reaction?
  • How can we precisely troubleshoot the issue ? What logs to look at ?
  • Is there a way to “flush” memory/cache regularly in order to avoid this saturation of the memory ?

We’d like to know if there we can optimize our settings or set some limits, as we can’t afford yet to simply upgrade our server, and again, those specs seems sufficient according the Minimum requirement page.

Server Setup Information

  • Version of Rocket.Chat Server: 3.2.2
  • Operating System: Ubuntu 18.04.3 (LTS) x64
  • Deployment Method: snap
  • Number of Running Instances: 1
  • DB Replicaset Oplog: Enabled
  • NodeJS Version: 12.16.1
  • MongoDB Version: 3.6.14
  • Proxy: Caddy