RocketChat / RocketChat/Rocket.Chat

Memory leak

Open
#13,602 15 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
46.1k
Forks
13.9k
Avg merge
3d 3h
Merged PRs (30d)
130

Description

Description:

I see memory leak on the latest rocket chat version 0.74.3
How can i debug the root cause of the issue ?

Expected behavior:

No memory leak :)

Actual behavior:

image

Server Setup Information:
  • Version of Rocket.Chat Server: 0.74.3
  • Operating System: Ubuntu 18.04.1
  • Deployment Method: docker
  • Number of Running Instances: 1
  • DB Replicaset Oplog: Disabled
  • NodeJS Version: v8.11.4
  • MongoDB Version: v4.0.5
Relevant logs:

I see some strange errors, that can be related to the issue:

[34mI20190302-14:54:21.610(0) Exception in onLogin callback: TypeError: Cannot redefine property: loginAt
at Function.defineProperty (<anonymous>)
at Object.keys.forEach.p (packages/rocketchat:statistics/server/lib/SAUMonitor.js:279:12)
at Array.forEach (<anonymous>)
at SAUMonitorClass._updateConnectionInfo (packages/rocketchat:statistics/server/lib/SAUMonitor.js:278:22)
at Accounts.onLogin.info (packages/rocketchat:statistics/server/lib/SAUMonitor.js:120:9)
at packages/callback-hook/hook.js:130:22
at _onLoginHook.each.callback (packages/accounts-base/accounts_server.js:178:7)
at Hook.each (packages/callback-hook/hook.js:108:15)
at AccountsServer._successfulLogin (packages/accounts-base/accounts_server.js:177:23)
at AccountsServer._attemptLogin (packages/accounts-base/accounts_server.js:350:12)
at MethodInvocation.methods.login (packages/accounts-base/accounts_server.js:520:23)
at MethodInvocation.methodMap.(anonymous function) (packages/rocketchat_monitoring.js:2731:30)
at maybeAuditArgumentChecks (packages/ddp-server/livedata_server.js:1767:12)
at DDP._CurrentMethodInvocation.withValue (packages/ddp-server/livedata_server.js:719:19)
at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1304:12)
at DDPServer._CurrentWriteFence.withValue (packages/ddp-server/livedata_server.js:717:46)
at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1304:12)
at Promise (packages/ddp-server/livedata_server.js:715:46)
at new Promise (<anonymous>)
at Session.method (packages/ddp-server/livedata_server.js:689:23)
at packages/ddp-server/livedata_server.js:559:43 
DDP RATE LIMIT: limit by connectionId per method
{
  "allowed": false,
  "timeToReset": 644,
  "numInvocationsLeft": 0,
  "userId": "oetxdmjGiBewXf34T",
  "clientAddress": "172.20.0.2",
  "type": "method",
  "name": "stream-notify-room",
  "connectionId": "rpkiRALqTkoMpSwjz",
  "broadcastAuth": false
}

Full logs:
Logs from the server interface:
server-rocket.log

Logs from docker container:
docker-rocket.log

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the stack trace in packages/rocketchat:statistics/server/lib/SAUMonitor.js, especially _updateConnectionInfo, and review the attached server and Docker logs. Reproduce the memory growth on the listed Rocket.Chat, NodeJS, MongoDB, Ubuntu, and Docker setup, then identify the cause and verify that the leak and related login errors are resolved.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, mongodb, nodejs
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.