Bad Gateway DigitalOcean

Description

Server Setup Information

  • Version of Rocket.Chat Server: 5.2.0
  • Operating System: Ubuntu
  • Deployment Method: Manual
  • Number of Running Instances: 1
  • DB Replicaset Oplog:
  • NodeJS Version: v14.19.3
  • MongoDB Version: 5.0.12
  • Proxy:
  • Firewalls involved:

Any additional Information

At seemingly random times, the server stops responding, giving a ‘Bad Gateway’ error. The URL of the server is acerachat.com. I can fix it by running ‘systemctl restart rocketchat’ manually, but that takes a while. It is deployed with the 1-click DigitalOcean installation. Thanks so much in advance!

Edit: When the error is occuring, ‘systemctl status rocketchat’ returns :

rocketchat.service - The Rocket.Chat server

Loaded: loaded (/lib/systemd/system/rocketchat.service; enabled; vendor pr>

Active: failed (Result: core-dump) since Thu 2022-10-27 14:32:46 UTC; 35s >

Process: 47311 ExecStart=/opt/nvm/versions/node/v14.19.3/bin/node /opt/Rock>

Main PID: 47311 (code=dumped, signal=ABRT)

Oct 27 14:32:46 AceraChat rocketchat[47311]: 21: 0xaab719 node::PerIsolatePlatf>

Oct 27 14:32:46 AceraChat rocketchat[47311]: 22: 0x13c0a86 [/opt/nvm/versions/>

Oct 27 14:32:46 AceraChat rocketchat[47311]: 23: 0x13d2ff4 [/opt/nvm/versions/>

Oct 27 14:32:46 AceraChat rocketchat[47311]: 24: 0x13c13d8 uv_run [/opt/nvm/ver>

Oct 27 14:32:46 AceraChat rocketchat[47311]: 25: 0xa7b642 node::NodeMainInstanc>

Oct 27 14:32:46 AceraChat rocketchat[47311]: 26: 0xa03805 node::Start(int, char>

Oct 27 14:32:46 AceraChat rocketchat[47311]: 27: 0x7ffaf484c083 __libc_start_ma>

Oct 27 14:32:46 AceraChat rocketchat[47311]: 28: 0x98c58c [/opt/nvm/versions/n>

Oct 27 14:32:46 AceraChat systemd[1]: rocketchat.service: Main process exited, >

Oct 27 14:32:46 AceraChat systemd[1]: rocketchat.service: Failed with result 'c>

I had a similar problem and posted about it on Rocket.Chat’s #support channel. Debdut Chakraborty posted a solution that thus far seems to have resolved the issue:

Edit the /lib/systemd/system/rocketchat.service file, add the line Environment=NODE_OPTIONS=--max_old_space_size=4096 with the other Environment lines. Then run systemctl daemon-reload systemctl restart rocketchat

Debdut explains that this will increase nodejs’ maximum heap size.
In my case, I also needed to reboot the system. I hope this helps!