ipsingh06 / seedsync

Sync your seedbox. Fast. And more.
https://ipsingh06.github.io/seedsync/
Apache License 2.0
312 stars 43 forks source link

Extreme high memory usage on Docker almost brings server down #107

Open casperse opened 3 years ago

casperse commented 3 years ago

Hi

I just found why I have had so many problems running Seedsync and the slow unresponsive usage of the UI Some configuration ? in the docker creates a very high memory usage after some time image It almost crashed all my dockers.... image

I have also created a support post to the where the Docker was created here: https://forums.unraid.net/topic/87798-support-selfhostersnets-template-repository/?do=findComment&comment=1042710

quadcom commented 3 years ago

I think this is a Docker thing. I used to run SS in a Docker container on my Synology NAS and kept running into the same thing. Limiting the amount of RAM attributed to that container helped the problem. If you give it full access to all the RAM given to Docker then yes, it can take it out.

The reason I think this is a Docker thing is I moved my setup into a VMWare ESXi server running Ubunutu and I don't have any issues with RAM usage at all. It still takes up all the RAM assigned but it never crashes and doesn't affect the over VM's in any way.

casperse commented 3 years ago

I actually think this is the way the docker is constructed because I did restrict everything! but somehow this docker was created not to follow the special parameters settings: --cpus=2 --memory=3G --log-opt max-size=50m --log-opt max-file=1 --restart unless-stopped --user 99:100

Do you have any good guide creating and setting up a VM running Seedsync :-)

casperse commented 3 years ago

Okay that wasn't easy... I now have ubuntu running Seedsync and a SMB mapped share to where the files should be downloaded But I cant find out how the path should be in Seedsync? my share works with: cd ~/share/downloads image

But what do I write here? image

I have tried so many paths... but just cant get it working?

casperse commented 3 years ago

I can delete and create files for my user And I have installed seedsync with my username

image

quadcom commented 3 years ago

Not a Linux expert by any means but for me....

AFAIK mounted volumes are always in the mnt folder. Navigate through the file structure via SSH and find the mnt folder. You should see the mounted volume there and be able to see the files/folders on the remote system.

Whatever path you went through to get there is the same path you put in SS

In my case I mounted a remote folder on my NAS to /mnt/ss_downloads. So that is the path that I put in SS

Hope that helps

quadcom commented 3 years ago

Also, make sure you edit fstab to make the mount persistent across reboots

https://askubuntu.com/questions/154180/how-to-mount-a-new-drive-on-startup

casperse commented 3 years ago

Cant say I am any Linux expert either :-) But I have been trying to get this working for the last +12 hours and I just cant seem to get the path right in the UI?

All the guides say you have to create the mount point in the username dir And I did get the fstab working and the ubuntu sees the shared drive and I can delete an create files on it I just cant insert the path into the UI the only thing working is this: (No error in the UI) /home/"username"/share/ubuntu/

But in the log file I can see this: 2021/10/11 19:14:12 - INFO - seedsync.ServerActionHandler - Received a restart action 2021/10/11 19:14:12 - INFO - seedsync - Exiting Seedsync 2021/10/11 19:14:15 - INFO - RemoteScanner.RemoteScanner - Skipping remote scanfs installation: already installed 2021/10/11 19:15:06 - INFO - seedsync.Controller - Received command Action.QUEUE for file #MAGAZINES 2021/10/11 19:15:06 - WARNING - ActiveScanner.ActiveScanner - Path does not exist: /home/"username"/share/ubuntu/#MAGAZINES

So you also did the fstab path in the ubuntu VM right? mine looks like this: //192.168.0.6/SERVER /home/username/share cifs credentials=/home/username/.smbcredentials,iocharset=utf8,file_mode=0777,dir_mode=077

So how does your path string look like?

And what is your path in the UI/GUI? /mnt/???

quadcom commented 3 years ago

First, have you created the target folder where you are telling Ubunutu to map the contents of the external share?

"/home/username/share" needs to actually exist. The system won't just automatically create that folder. Also, I may be wrong but I recall that externally mounted volumes need to be in the mnt folder. Putting it in the /homes/$user folder won't work.

//192.168.200.89/Sync/Seedbox/1-Incoming /mnt/ss_downloads cifs uid={uid},username={uname},password={passwrd},iocharset=utf8,file_mode=0777,dir_mode=0777

//192.168.200.89/Sync/Seedbox/1-Incoming - The target on my NAS where files are stored

/mnt/ss_downloads - The directory on the SS box that the NAS contents are mapped to

cifs - Share protocol

uid={uid},username={uname},password={passwrd} - Credentials needed to authenticate on the remote server NAS

iocharset=utf8,file_mode=0777,dir_mode=0777 - Used to configure permissions and communications charset

I'm also assuming that where you put "username" you really mean the actual user's username. It is not a dynamic field that will change depending on who's logged into the SS system.

casperse commented 3 years ago

Yes all my mounted folders are created by me....nothing is automatic on Linux LOL

I moved the mount to: /mnt/user/share

But then after reboot I get this error and Seedsync dosent start up

casperse@seedsync:~/Downloads$ sudo dpkg -i seedsync_0.8.6_amd64.deb (Reading database ... 164177 files and directories currently installed.) Preparing to unpack seedsync_0.8.6_amd64.deb ... Unpacking seedsync (0.8.6) over (0.8.6) ... Setting up seedsync (0.8.6) ... Setting user to casperse A dependency job for seedsync.service failed. See 'journalctl -xe' for details. Processing triggers for libc-bin (2.31-0ubuntu9.2) ...

I have removed it and all the files in the: home/user-name/.seedsync

But something is now broken? Do you know what this error message means I have tried googleling it but havent found anything

journalctl -xe -- -- A start job for unit 192.168.0.6-SEED.mount has finished with a failure. -- -- The job identifier is 1779 and the job result is failed. Oct 11 20:04:14 seedsync systemd[1]: Dependency failed for Local File Systems. -- Subject: A start job for unit local-fs.target has failed -- Defined-By: systemd -- Support: http://www.ubuntu.com/support -- -- A start job for unit local-fs.target has finished with a failure. -- -- The job identifier is 1766 and the job result is dependency. Oct 11 20:04:14 seedsync systemd[1]: Dependency failed for Job that runs the Se> -- Subject: A start job for unit seedsync.service has failed -- Defined-By: systemd -- Support: http://www.ubuntu.com/support -- -- A start job for unit seedsync.service has finished with a failure. -- -- The job identifier is 1730 and the job result is dependency. Oct 11 20:04:14 seedsync systemd[1]: seedsync.service: Job seedsync.service/sta> Oct 11 20:04:14 seedsync systemd[1]: local-fs.target: Job local-fs.target/start> Oct 11 20:04:15 seedsync sudo[2330]: pam_unix(sudo:session): session closed for> lines 2649-2671/2671 (END)

quadcom commented 3 years ago

take the user out of the mnt path. Mounts are not user-specific they are system level.

/mnt/mount

'/home/user-name/.seedsync' is where all the config files are. Leve that alone. All we need to do is map the network drive to a mount folder in Ubuntu. That's what the line in FSTAB does. If you SSH to that mounted folder, can you see the files on the remote server? If you can't the shared mount needs to be resolved before anything will start to work.

quadcom commented 3 years ago

image

quadcom commented 3 years ago

Do you have cifs-utils installed?

sudo apt-get install cifs-utils

casperse commented 3 years ago

Okay now I have seedsync installed again and the mount in "mnt" and I can CD to that mount in the terminal window image

But even if this looks fine and I can create folders on the SMB share when I try to sync a dir I get this again: image

The #MAGAZINE is the folder from the server that Seedsync trieds to fetch

quadcom commented 3 years ago

what are the permissions on the mounted parent DIR (//192.168.0.6/SERVER)?

Also, Unix-based systems are case-sensitive. Could there be a mixed-case thing going on here? I tend to keep everything lower case all the time.

I'm also thinking about the hash prepending the folder name. I tested it on my NAS and I could create it but I wonder if it might be causing issues?

casperse commented 3 years ago

Maybe! - Do I need to use the UID from the Unraid share SEED and add that to the fstab file that would be the nobody user thinks that UID 99? Or could it be a path problem? image Dont know, but I think that this command should go to the mount? from the home dir

Think I have to take a break been at it for a very long time Thanks for your help! - much appreciated

quadcom commented 3 years ago

The UID is going to be the users account on the mounted system along with the username and password. Make the username and password on the Seedsync server the same.

From the SS SSH, try and create a folder in the mounted DIR. See if it works or if you get an error or if it create a folder.

quadcom commented 3 years ago

Ok, mnt is at the root level, it's not inside the home dire

MNT and HOME are at the same level

casperse commented 3 years ago

It works I can create a new folder in the /mnt/SEED using the terminal image

So the system ubuntu have write access to the share through the /mnt/SEED so this should work right?

quadcom commented 3 years ago

so next thing is determine what user SS is running under

HTOP

casperse commented 3 years ago

Sorry took a little time finding out what htop is and installing it :-)

image

quadcom commented 3 years ago

-Add your user account to the SUDO group sudo usermod -aG sudo casperse

-Check the assignment sudo whoami

It should come back as 'root'

quadcom commented 3 years ago

This should be working AFAIK

if you're logged in as casperse and you've created a folder in the mnt/SEED folder. And SS is running as casperse. There shouldn't be any issues for SS to store files there.

The only thing left that we can try is to drop the hash tag from the folder names.

casperse commented 3 years ago

Yes that was okay: image

Trying to sync a folder without "#" image

image

This is so strange..... The Docker worked but was eating up all my memory and this runs great very fast UI but will not transfer?

Have to go to and get some sleep and some new ideas - maybe that will solve it LOL I havent given up yet - this is a great application just need to get it up and running

casperse commented 3 years ago

Oh one last thing I just got this in the share folder image

Inside the file it says: size=-2 0.pos=0

quadcom commented 3 years ago

Hang on a sec here.

Looking at the path in the screenshot you posted, your share is /192.168.0.6/seed/downloads

that is not the path you have in FSTAB

first, you entered SEED not seed. Those are different directories in the eyes of Linux.

Also, there's another folder after seed, downloads. Is that where you want SS to save downloads to? If so then you need to edit your mount.

//192.168.0.6/seed/downloads /mnt/seed cifs uid={uid},username={uname},password={passwrd},iocharset=utf8,file_mode=0777,dir_mode=077

quadcom commented 3 years ago

I would suggest skipping the credentials file as it may be introducing its own permissions problems to the situation. I inline my credentials in FSTAB. I'm the only one using this system so I'm not concerned about hyper security.

casperse commented 3 years ago

No I actually changed that after you showed me your config (I removed the credential file) //192.168.0.6/SEED/downloads /mnt/SEED cifs uid=99,username=myname,password=mypasswsord,iocharset=utf8,file_mode=0777,dir_mode=0777 0 0

The server SMB share is: (SEED is the drive sharename) \192.168.0.6\SEED\downloads

This should work....didn't help sleeping on it :-)