Open Angstroem opened 3 years ago
Hi @Angstroem! If you access the folder where the uploads are saved, does the image appear normal? Also, if you upload the same image again, does it corrupt again?
The logs you sent from the browser seem to be browser's extensions errors (maybe some extension you had installed does not work with rocket.chat). It would be really nice to see if the server logs anything AFTER a corrupted image is uploaded.
I tried the FileSystem on the latest (using a local folder) and it seems to work fine (uploaded a couple dozen pictures). Since you're using a remove storage for the uploads, it looks like it can be a connection problem between the server OS and this remote storage.
Can you provide the additional info so we can have a better understanding of what is going on? Thanks!
Hello @gabriellsh, thanks for your fast reply!
First, i dont think that a network connection issue or bottleneck is the cause of this problem. Rocket.Chat is deployed in its own VM which is hosted together with a FreeNAS VM on the same server. The host server runs Windows Server 2016 with 2x4c/8t Xeon Processors and 128Gb of RAM (where 6Gb are allocated for the Rocket.Chat VM and 16Gb for the FreeNAS VM hosting the network shares). The Rocket.Chat VM also has its own dedicated user as well as dataset in FreeNAS.
Based on your suggestion i suspect the problem comes from the network share configuration itself. When i manually search for a corrupted picture in the network share and download the file to my local machine, it does not show as a corrupted image anymore when opening with a picture viewer. But downloading the same image through the Rocket.Chat client leads to the image being corrupted.
This screenshot, along with the following procedure, shows what i observed:
Procedure used:
https://<instance_name>/file-upload/Qi7mG86an*********/20201227_131035.jpg
-> Qi7mG86an*********
Qi7mG86an*********
from the network share (in the folder /file-uploads
) and putting a .jpg
at the endHowever, i may found a solution! I explicitly disabled file system caching in the Rocket.Chat VM static file system fstab. Here is the part of my fstab-configuration responsible for the network share that Rocket.Chat should use (uid 1001 is the user rocketchat
):
# /etc/fstab
# Rocket.Chat appdata network share
//<address_of_freenas_share>/rocket-chat /mnt/share cifs uid=1001,credentials=/<path_to_credential_file>/.smb_pwfile,cache=none
Since then i was not able to reproduce the problem anymore and i am still on version 3.9.3. I tested over 50 different photos, not a single one corrupted. I will leave file system caching off as it fixes my problem for now, but it would be nice if someone with the same configuration as i have tries to reproduce what i discovered. There may be a bug somewhere as caching should not influence data integrity. But correct me if i am wrong.
Btw. there were no server-log entries even before the update to 3.9.3 indicating something wrong after a picture that corrupted was being uploaded to the Rocket.Chat.
FYI: When i disable caching again (removing cache=none
from fstab), i can instantly reproduce the problem in my enviroment.
Thanks a lot for your detailed explanation @Angstroem! I'll leave this issue open, but I ask: Can you rename it to more appropriately match the issue with caching? Thanks! I'll leave the issue open, since there may still be a bug.
Once again, thanks for your contribution!
Okay, done! Thanks for your support as well.
Here are some further information on my Linux VM that is running Rocket.Chat:
Linux Debian kernel version:
Linux RocketChat 4.19.0-13-amd64 #1 SMP Debian 4.19.160-2 (2020-11-28) x86_64
cifs-utils version:
Package: cifs-utils
Version: 2:6.8-2
Priority: optional
Section: otherosfs
Maintainer: Debian Samba Maintainers <pkg-samba-maint@lists.alioth.debian.org>
Installed-Size: 237 kB
Let me know if you need any more information from my instance.
Description:
When using the mobile Rocket.Chat app on android or the PC app to send one or more pictures to the Rocket.Chat instance, some of the uploaded pictures are corrupted (e.g. one half of the picture is black/transparent). This behaviour could be observed from us on multiple android phones (including three samsung galaxy s10+, a galaxy s20, an older a-series phone, etc) as well as PCs. Also, this does happen to almost every fifth pictures, especially when sending multiple pictures at once (but single pictures were also affected from time to time).
Steps to reproduce:
Expected behavior:
All pictures should be uploaded correctly and with full integrity.
Actual behavior:
Some pictures corrupt as seen in this screenshot:
When clicking on the image with the PC app or using the browser, the following can be observed:
On the android app, the same behaviour is seen. Furthermore, when downloading the file itself to the PC and opening it up with a picture viewer, this mess is shown:
This behaviour could also be observed when sharing pictures directly from the PC app/browser. File uploads on the other hand (for example a .zip-archive) seem to work just fine.
Server Setup Information:
Client Setup Information
Android app:
PC app:
Additional context
The instance does store all uploads (and custom emojis, etc) with the Storage Type FileSystem. The corresponding System Path is pointing to a folder which is mapped to a network drive using the static filesystem fstab. The user
rocketchat
has rwx permissions on this folder as seen in this picture:This issue shows the same behaviour as we are getting.
Relevant logs:
Logs from the browser console:
Server logs (after updating to the newest version today):