RocketChat / RocketChat/Rocket.Chat

Attachments take ages to upload and view

Open
#24,266 14 comments 0 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

We have an issue after upgrading our Rocket.Chat install to the latests, server / client and MongoDB (see versions below)

After upgrading, first to wiredTiger, then to version 4.2 / 4.4 then 5.0 all attachments added to chats i.e. images / audio / video etc take an inordinate amount of time.
Also clicking on these attachments also take an inordinate amount of time to show or start playing.
By inordinate I mean 3 - 5 minutes to show images or upload new attachments as oppose to just a few seconds previously.
None of our attachments are particularly large and affect ALL existing attachments (viewing) and new attachments (upload and or view)

The stack trace

I get the following stack traces in the Rocket.Chat logs which seems to indicate a missing parameter OR missing indexes. Any ideas how to fix this will be appreciated..

ufs: cannot read file "mC3nrWQ3cY7ifoJwz" (Executor error during find command :: caused by :: Sort exceeded memory limit of 104857600 bytes, but did not opt in to external sorting.) MongoError: Executor error during find command :: caused by :: Sort exceeded memory limit of 104857600 bytes, but did not opt in to external sorting.
at MessageStream.messageHandler (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/cmap/connection.js:272:20)
at MessageStream.emit (events.js:314:20)
at MessageStream.EventEmitter.emit (domain.js:483:12)
at processIncomingData (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/cmap/message_stream.js:144:12)
at MessageStream._write (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/cmap/message_stream.js:42:5)
at doWrite (_stream_writable.js:403:12)
at writeOrBuffer (_stream_writable.js:387:5)
at MessageStream.Writable.write (_stream_writable.js:318:11)
at Socket.ondata (_stream_readable.js:718:22)
at Socket.emit (events.js:314:20)
at Socket.EventEmitter.emit (domain.js:483:12)
at addChunk (_stream_readable.js:297:12)
at readableAddChunk (stream_readable.js:272:9)
at Socket.Readable.push (stream_readable.js:213:10)
at TCP.onStreamRead (internal/stream_base_commons.js:188:23)
at TCP.callbackTrampoline (internal/async_hooks.js:126:14) {
ok: 0,
code: 292,
codeName: 'QueryExceededMemoryLimitNoDiskUseAllowed',
'$clusterTime': {
clusterTime: Timestamp { bsontype: 'Timestamp', low: 2, high
: 1642705737 },
signature: { hash: [Binary], keyId: 0 }
},
operationTime: Timestamp { bsontype: 'Timestamp', low: 2, high
: 1642705737 }

Server Setup Information:
  • Version of Rocket.Chat Server: 4.3.2
  • Operating System: Ubuntu 20.04
  • Deployment Method: Docker
  • Number of Running Instances: 1
  • DB Replicaset Oplog: --oplogSize 128 --replSet rs0 --storageEngine=wiredTiger (single instance replica set)
  • NodeJS Version: v12.22.8
  • MongoDB Version: 5.0.5
  • Using GridFS for file storage
Client Setup Information
  • Desktop App or Browser Version: Both
  • Operating System: Multiple

Steve

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 by reproducing attachment upload and viewing with GridFS while inspecting the MongoDB query behind the ufs: cannot read file error and the MessageStream stack trace. Done means existing attachments load and new attachments upload or play promptly without the sort-memory error.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.