RocketChat / RocketChat/Rocket.Chat
User Data Download cycle ERR_OUT_OF_RANGE
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 46.1k
- Forks
- 13.9k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 130
Description
Server Setup Information:
- Version of Rocket.Chat Server: 7.4.1
- License Type: community
- Number of Users: 200
- Operating System: debian
- Deployment Method: docker compose
- Number of Running Instances: 1
- DB Replicaset Oplog: Enabled
- NodeJS Version: 22.13.1 - x64
- MongoDB Version: 7.0.17
Actual behavior:
At about 4:15 a.m., the user started uploading his data(User Data Download):
rocketchat created a temporary folder
4.8G /tmp/userDataHaOgEK/67dc30e98a9853c53c708386/
and file:
4.3G /tmp/zipFiles/e46b11f4-653e-4986-9a79-edd711cf2608.zip
After that, rocketcat went into a cyclical OOM Killer reboot.
This error was constantly repeated in the logs:
rocketchat-1 | RangeError [ERR_OUT_OF_RANGE]: The value of "length" is out of range. It must be >= 0 && <= 2147483647. Received 4_564_198_603
rocketchat-1 | at Object.writeSync (node:fs:912:5)
rocketchat-1 | at Object.writeFileSync (node:fs:2446:26)
rocketchat-1 | at FileUploadClass._doInsert (app/file-upload/server/lib/FileUpload.ts:777:8)
rocketchat-1 | at processTicksAndRejections (node:internal/process/task_queues:105:5)
rocketchat-1 | at uploadZipFile (server/lib/dataExport/uploadZipFile.ts:38:15)
rocketchat-1 | at continueExportOperation (server/lib/dataExport/processDataDownloads.ts:232:28)
rocketchat-1 | at Module.processDataDownloads (server/lib/dataExport/processDataDownloads.ts:264:2)
rocketchat-1 | at runCronJobFunctionAndPersistResult (/app/bundle/programs/server/npm/node_modules/@rocket.chat/cron/src/index.ts:14:18)
rocketchat-1 | at Object.fn (/app/bundle/programs/server/npm/node_modules/@rocket.chat/cron/src/index.ts:130:4)
rocketchat-1 | at /app/bundle/programs/server/npm/node_modules/@rocket.chat/agenda/src/Job.ts:252:6 {
rocketchat-1 | code: 'ERR_OUT_OF_RANGE'
rocketchat-1 | }
After the container was recreated, the file was deleted and there was an error in the server logs all the time:
rocketchat-1 | Error: ENOENT: no such file or directory, stat '/tmp/zipFiles/e46b11f4-653e-4986-9a79-edd711cf2608.zip'
rocketchat-1 | at stat (node:internal/fs/promises:1036:18)
rocketchat-1 | at uploadZipFile (server/lib/dataExport/uploadZipFile.ts:12:19)
rocketchat-1 | at continueExportOperation (server/lib/dataExport/processDataDownloads.ts:232:28)
rocketchat-1 | at Module.processDataDownloads (server/lib/dataExport/processDataDownloads.ts:264:2)
rocketchat-1 | at runCronJobFunctionAndPersistResult (/app/bundle/programs/server/npm/node_modules/@rocket.chat/cron/src/index.ts:14:18)
rocketchat-1 | at Object.fn (/app/bundle/programs/server/npm/node_modules/@rocket.chat/cron/src/index.ts:130:4)
rocketchat-1 | at /app/bundle/programs/server/npm/node_modules/@rocket.chat/agenda/src/Job.ts:252:6 {
rocketchat-1 | errno: -2,
rocketchat-1 | code: 'ENOENT',
rocketchat-1 | syscall: 'stat',
rocketchat-1 | path: '/tmp/zipFiles/e46b11f4-653e-4986-9a79-edd711cf2608.zip'
rocketchat-1 | }
I have not found a tool or interface for clearing the "Processing Frequency" queue.
I went into the container and did:
mkdir /tmp/zipFiles/
touch /tmp/zipFiles/e46b11f4-653e-4986-9a79-edd711cf2608.zip
after that, the error disappeared.
Steps to reproduce:
- Create a lot of attachments for user
- Initiate User Data Download
- Get an error
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with server/lib/dataExport/uploadZipFile.ts and server/lib/dataExport/processDataDownloads.ts, then inspect FileUpload.ts around _doInsert at line 777. Reproduce the User Data Download with a large attachment set and trace the queued file through the upload flow. Done should prevent the ERR_OUT_OF_RANGE/OOM cycle and handle a missing queued ZIP without repeated errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- backend, data-engineering
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100