RocketChat / RocketChat/Rocket.Chat

Small files upload problem multi-instances v. 0.57.1

Open
#7,485 4 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

Rocket.Chat Version: 0.57.1
Running Instances: 2
DB Replicaset OpLog: Enabled
Node Version: 4.5.0
GlusterFS: YES

I have a problem with file upload. When I upload small file in chat i have an error 500 on bar at top of the window.

Error in log:

Jul 13 14:36:02 rocket-prod-app02 rocketchat-0: { [Error: ENOENT: no such file or directory, open '/tmp/ufs/fY7FCMZZYEgmKrkNw'] Jul 13 14:36:02 rocket-prod-app02 rocketchat-0: errno: -2, Jul 13 14:36:02 rocket-prod-app02 rocketchat-0: code: 'ENOENT', Jul 13 14:36:02 rocket-prod-app02 rocketchat-0: syscall: 'open', Jul 13 14:36:02 rocket-prod-app02 rocketchat-0: path: '/tmp/ufs/fY7FCMZZYEgmKrkNw' } Jul 13 14:36:02 rocket-prod-app02 rocketchat-0: [Error: FileNotFound: no file with id fY7FCMZZYEgmKrkNw found] Jul 13 14:36:02 rocket-prod-app02 rocketchat-0: Exception while invoking method 'ufsComplete' Error: ENOENT: no such file or directory, open '/tmp/ufs/fY7FCMZZYEgmKrkNw' Jul 13 14:36:02 rocket-prod-app02 rocketchat-0: at Object.Future.wait (/home/rocket.chat/Rocket.Chat/programs/server/node_modules/fibers/future.js:449:15) Jul 13 14:36:02 rocket-prod-app02 rocketchat-0: at [object Object].Meteor.methods.ufsComplete (/home/rocket.chat/Rocket.Chat/programs/server/packages/jalik_ufs.js:818:24) Jul 13 14:36:02 rocket-prod-app02 rocketchat-0: at [object Object].methodsMap.(anonymous function) (/home/rocket.chat/Rocket.Chat/programs/server/packages/rocketchat_lib.js:1028:26) Jul 13 14:36:02 rocket-prod-app02 rocketchat-0: at [object Object].methodMap.(anonymous function) (packages/rocketchat_monitoring.js:2731:30) Jul 13 14:36:02 rocket-prod-app02 rocketchat-0: at maybeAuditArgumentChecks (/home/rocket.chat/Rocket.Chat/programs/server/packages/ddp-server.js:1823:12) Jul 13 14:36:02 rocket-prod-app02 rocketchat-0: at /home/rocket.chat/Rocket.Chat/programs/server/packages/ddp-server.js:905:20 Jul 13 14:36:02 rocket-prod-app02 rocketchat-0: at [object Object]._.extend.withValue (packages/meteor.js:1122:17) Jul 13 14:36:02 rocket-prod-app02 rocketchat-0: at /home/rocket.chat/Rocket.Chat/programs/server/packages/ddp-server.js:904:41 Jul 13 14:36:02 rocket-prod-app02 rocketchat-0: at [object Object]._.extend.withValue (packages/meteor.js:1122:17) Jul 13 14:36:02 rocket-prod-app02 rocketchat-0: at /home/rocket.chat/Rocket.Chat/programs/server/packages/ddp-server.js:903:46 Jul 13 14:36:02 rocket-prod-app02 rocketchat-0: at [object Object]._.extend.protocol_handlers.method (/home/rocket.chat/Rocket.Chat/programs/server/packages/ddp-server.js:876:21) Jul 13 14:36:02 rocket-prod-app02 rocketchat-0: at /home/rocket.chat/Rocket.Chat/programs/server/packages/ddp-server.js:755:85 Jul 13 14:36:02 rocket-prod-app02 rocketchat-0: - - - - - Jul 13 14:36:02 rocket-prod-app02 rocketchat-0: at Error (native) Jul 13 14:36:02 rocket-prod-app02 rocketchat-0: rocketchat_logger rocketchat_logger.js:377 #033[34mMeteor ➔ method#033[39m ufsDelete -> userId: NXKRZCXfSg8St2SLS , arguments: { '0': 'fY7FCMZZYEgmKrkNw', '1': 'Uploads', '2': '083b79D9B9'}

It's look like second instance try to read file that first instance didn't finish uploading yet. With larger files (more than 1MB) is everything OK. Also when I'm running one instance of Rocket.Chat file upload work properly.
I have an idea to add a Delay (setTimeout()) in function that is responsible for uploading, but i don't know which one it is.

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 packages/jalik_ufs.js at the ufsComplete method shown in the stack trace, and reproduce the upload using two Rocket.Chat instances with a small file. Compare the behavior with a single instance and with larger files. Done means small-file uploads succeed across two instances without the ENOENT or FileNotFound errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
backend, distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.