lostb1t / replex

Remix your Plex hubs
219 stars 7 forks source link

Replex hitting my cpu 100% #4

Closed jl94x4 closed 1 year ago

jl94x4 commented 1 year ago

Logs: https://pastebin.com/RgN3Swi8

I'm using nginx proxy manager to forward ip:90 to plex.domain.co.uk however when forwarding requests through the proxy on plex its hitting my CPU 100% max.

Also using SSL.

What am I doing wrong?

lostb1t commented 1 year ago

Seems like web sockets is not correctly proxied.

Take a look at the example nginx here: https://github.com/sarendsen/replex/blob/0c2df68dcecf54515609bb11f2a74437b7d7d61d/docker/default.conf.template#L48

Need to have set proper web socket headers for the upstream.

fyi: There is also an option to let replex generate SSL for you. I haven't tested this but you could try it if you have troubles with nginx

You can set the following ENV too enable it:

SSL_ENABLE=true SSL_DOMAIN="plex.domain.co.uk"

And point plex.domain.co.uk to the replex instance (without nginx in between): Sot it becomes: plex.domain.co.uk to -> replex -> plex

jl94x4 commented 1 year ago

Ah I forgot to mention I'm using nginx proxy manager to proxy replex

lostb1t commented 1 year ago

Did you enable websocket support?

jl94x4 commented 1 year ago

Did you enable websocket support?

I did, yes

Problem still persists.

lostb1t commented 1 year ago

Can you post the new log after enabling websockets?

jl94x4 commented 1 year ago

Can you post the new log after enabling websockets?

Sorry it was enabled from the start, these logs include that option being enabled.

Before enabling it I was getting unable to listen in events, enabling that fixed that issue but now I get high cpu usage.

lostb1t commented 1 year ago

After restarting Replex does the cpu comes down?

jl94x4 commented 1 year ago

For maybe 5mins, then goes back up.

lostb1t commented 1 year ago

It's def an issue with websockets. Can't replicate it with normal nginx or traefik.

Will see if I can setup nginx proxy manager this week to see if I can replicate. Seems websocket is being thrown in a loop by it

lostb1t commented 1 year ago

I'm seeing this on my own server aswell. Randomly tho. Will investigate

jl94x4 commented 1 year ago

I'm seeing this on my own server aswell. Randomly tho. Will investigate

Any update :)

jl94x4 commented 1 year ago

This is a log without using NPM, still hitting my CPU 100%. Any advice is appreciated

https://pastebin.com/8QVvCzep

jl94x4 commented 1 year ago

image

lostb1t commented 1 year ago

can you pull the latest image? I reworked a few things

jl94x4 commented 1 year ago

Still flat 100% CPU

image

jl94x4 commented 1 year ago

After disabling REPLEX

image

lostb1t commented 1 year ago

interesting. What hardware and OS are you running it on?

jl94x4 commented 1 year ago

interesting. What hardware and OS are you running it on?

Its a 6700K with 32GB RAM, Linux Ubuntu 22.04.

Just re-doing the entire setup from scratch using NPM again. Will report back results.

lostb1t commented 1 year ago

I'm have it too but only after a a few days of usage. Not right after a restart. I'm still looking into it but might take a while as debugging this is fairly time consuming

jl94x4 commented 1 year ago

Yeah, seems to go a few days with low CPU, then after a few days it'll be slammed. It does this even on a normal Nginx config though, is this the same behaviour for you?

I'm not familiar with Traefik, only used Nginx and NPM.

lostb1t commented 1 year ago

Yeah this is a Replex problem. Not nginx. A thread goes haywire at one point. There's nothing you can do from your end. I'll see if I can dig into it this weekend

jl94x4 commented 1 year ago

Yeah this is a Replex problem. Not nginx. A thread goes haywire at one point. There's nothing you can do from your end. I'll see if I can dig into it this weekend

Okay, so this is happening with everyone using Replex?

lostb1t commented 1 year ago

I assume so yes. Welcome to beta software ;)

lostb1t commented 1 year ago

Could you give the latest version another go? its running fine for me the past 24 hours.

jl94x4 commented 1 year ago

Giving this ago now.

I'm also a little bit confused about you closing the other issue regarding recently added rows. The recently added rows I am talking about it the ones Plex create, not custom collections I've created?

lostb1t commented 1 year ago

What I mean is that i cannot fix the recently added show row as it's basicly a bug in the plex web app. If you still want to have a recently added show row. You can recreate that functionality with a smart collection and disable the built in row

jl94x4 commented 1 year ago

Still hitting 100% CPU after around 20hours. Having to restart the process to bring CPU back down then after some time it gradually goes back to 100%.

lostb1t commented 1 year ago

Thanks for taking the time to report back. Did you watch anything in the last 20 hours? If so on which clients

jl94x4 commented 1 year ago

Thanks for taking the time to report back. Did you watch anything in the last 20 hours? If so on which clients

Yes, I've used a Roku Streaming Stick + Chromecast with Google TV. There are other people who are on my server also watching things, mainly Roku and Android devices.

jl94x4 commented 1 year ago

image

Over the past 10mins, its pretty unusable at the moment, its caused Plex to crash a few times due to CPU load. Are you seeing this kind of behaviour on your end?

lostb1t commented 1 year ago

I'm not but I don't use plex that intensive.

I'm gonna revert back to nginx handling the non Replex routes untill I have proper time to debug this. I'll let you know when I release it.

lostb1t commented 1 year ago

Allright new version released. Let me know if it happens again

lostb1t commented 1 year ago

fyi: I moved nginx to an separate image ghcr.io/sarendsen/replex-nginx:latest so make sure to use that one instead of the regular.

I also added a new functionality to load the artwork for hero styles from tmdb. See the README for info

jl94x4 commented 1 year ago

Been using it now for over 24hours and had no high CPU Usage.

As for the TMDB that's nice! I'll check it out.

EDIT: For the TMDB would it be a case of...

docker run --rm -it -p 90:80 -e REPLEX_HOST="http://116.202.237.239:32400" -e REPLEX_TMDB_API_KEY=apikey ghcr.io/sarendsen/replex:latest

EDIT2: Its working great :)

lostb1t commented 1 year ago

I think I found the culprit, if you could give the regular image a try that would be great