ptrumpis / snap-camera-server

An alternative, self-hosted solution that allows you to continue using Snap Camera with all Snapchat filters after its shutdown on January 25, 2023.
https://github.com/snapcamera
MIT License
351 stars 44 forks source link

Error (HTTP code 500) #39

Closed Fan4eGGG closed 1 year ago

Fan4eGGG commented 1 year ago

A strange error came out of nowhere. Yesterday everything was working, today THIS error appears. What do I do?

ptrumpis commented 1 year ago

Looks like the port 5645 is already in use. Is there another server running on your system? Did you change your firewall settings?

Edit: You can also attach images to this ticket.

Fan4eGGG commented 1 year ago

I don't know if the port is busy right now, how do I check it? Or fix it?

ptrumpis commented 1 year ago

I don't know if the port is busy right now, how do I check it? Or fix it?

How to check depends on your operating system and available tools. I would run the command netstat -np TCP | grep :5645 on my Windows bash / powershell

If it was working yesterday you must have changed something on your system. e.g. Installed new software, updated your operating system. It could be your firewall blocking the port.

You can try to edit the .env file and change APP_LOCAL_PORT to 15645 or any other number above 5000 https://github.com/ptrumpis/snap-camera-server/blob/main/example.env#L47C20-L47C20

Fan4eGGG commented 1 year ago

netstat -np TCP | grep :5645 give me nothing. it says

'grep' is not recognized as an internal or external command operable program or batch file

ptrumpis commented 1 year ago

You need to run the command inside windows powershell, it will not produce any output if the port is not occupied.

However you should try different port numbers in your .env file as mentioned above. If it doesn't help than you most likely have to check your firewall settings.

Fan4eGGG commented 1 year ago

i think the command is broken on my pc :D it shows me this, but its on russian

ptrumpis commented 1 year ago

Well its probably not available on your computer then. Just netstat -np TCP shoud work though, it will show a list of all your open ports.

Fan4eGGG commented 1 year ago

btw, I changed the port to 15645 and it still gives the same error.

Fan4eGGG commented 1 year ago

netstat -np TCP It didn't show me port 15645 or 5645. I think I'm doing something wrong.

ptrumpis commented 1 year ago

netstat -np TCP It didn't show me port 15645 or 5645. I think I'm doing something wrong.

Because the port is not occupied -> Check your Firewall

Fan4eGGG commented 1 year ago

What exactly am I supposed to find there? Can you give me a hint?

ptrumpis commented 1 year ago

You should grant access to Docker and/or allow tcp port 5645 (and all other ports if necessary).

You can lookup tutorials on the internet on how to do that.

Fan4eGGG commented 1 year ago

oh. I gave full access to these two ports in my firewall and I still get the same error.

Fan4eGGG commented 1 year ago

ok. wait. Now everything works stably, BUT. for some reason, if you exit Docker and come back, turn on SnapServer, this error appears again. but if you reboot your PC and enter Docker for the first time, everything works before you exit it.

btw, can I ask you a second question? I don't know if it's on topic or not, but when I turn on SnapServer, VMEM "thing" appears in the taskbar, and it consumes quite a lot of RAM (about 7GB), is there any way to low this?

ptrumpis commented 1 year ago

You need to check your Docker settings. There are multiple ways to reduce memory but it depends on your settings and your system. The official Docker page can provide more details on this.

If you have WSL2 enabled in your settings you should also check the official Microsoft WSL page on how du reduce memory.

Creating a file called .wslconfig in your %USERPROFILE% folder can also help.

.wslconfig

[wsl2] 
memory=2GB
processors=2
swap=2GB
Fan4eGGG commented 1 year ago

Yes, now wsl consumes no more than 2gb. but can I reduce it further? won't it hurt Docker? what is the minimum amount of RAM I can set?

ptrumpis commented 1 year ago

It depends on your system and how many other containers are running. There is no general answer.

These are valid, but it might crash your system/server.

[wsl2] 
memory=512MB
processors=2
swap=0
Fan4eGGG commented 1 year ago

yeah ok. My problem has been solved, so I think the topic can be closed. thanks for your help.