RocketChat / RocketChat/Rocket.Chat
File upload problem
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 have a problem setting the file size limit on upload. I set a limit of 150 M (in bytes in the web administration GUI). And I am using nginx reverse proxy and in nginx.conf file I am setting the same client_max_body_size. But when I try to upload a file larger than 150MB, I see in whireshark an HTTP-package with 413 Response code ("entity is too large") from nginx but at the same time I see a tcp-session in which the uploaded file is uploaded to the server. This is confirmed by the checked RX bytes in the "netstat -ie" command after file uploading. At the same time, the file download progress bar reaches the final and no error messages or notifications appear in the user GUI. Also, the specified file does not appear either in the used chat window or in the file storage (I use the FileSystem storage type on my server). When I disable nginx, I get a situation in which, with a large file size ~ 1G, the chat server hangs and all clients lose connection and response from the server. Obviously, in a chat situation, there is no need to send large files, but the very situation in which a user can break it by mistake is bad.
Steps to reproduce:
- Setup file size upload constraint.
- Upload file ~1G or more size to server (I guess it depends on computing power)
Expected behavior:
It is expected to receive a response from the server that the file is too large before it starts downloading and cancel the download of the file.
Actual behavior:
The file is uploaded to the server, but is not displayed either in the correspondence or in the file storage. If the file size is large enough, the server crashes.


Pcap file was dumped on server machine while file uploading (provided start of uploading and end of tcp-session, note the package numbers)
Server Setup Information:
- Version of Rocket.Chat Server: 5.3.0
- Operating System: ubuntu 20.04.5 LTS
- Deployment Method: tar
- Number of Running Instances: 1
- NodeJS Version: 14.21.1 -x64
- MongoDB Version: 4.4.17
Client Setup Information
- Desktop App or Browser Version: Mozilla Firefox 106.0.5 (64-bit)/Rocket.Chat 3.8.13
- Operating System: Windows 10 Pro and ubuntu 20.04.5 LTS
Relevant logs:
There is no logs about server failure.
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 the nginx.conf upload limit and trace the Rocket.Chat file-upload path for requests rejected with HTTP 413. Reproduce the 150 MB and ~1 GB cases with nginx enabled and disabled, then verify that oversized uploads are rejected before transfer completes, do not appear in storage or chat, and do not destabilize the server.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nginx, typescript
- Domain
- backend, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100