Jump to content

Random 502 - Bad Gateway on server


CoeFamily
 Share

Recommended Posts

CoeFamily

Hello,

Last night i set up Emby for the first time and had everything working perfect, both local and remote access.

After initial server creation and while scanning for library files, my server suddenly shut down and when i closed the browser and relogged into my TerraMaster NAS to access Emby, i received "502 - Bad Gateway", with some nginx version i can't remember.

I uninstalled Emby, and reinstalled on the NAS and then it all worked perfectly. Library files got scanned and i got local and remote access working and thought nothing more of it.

I woke up this morning and was unable to connect via mobile. Logged onto NAS to check server and the same thing, 502 error.

This time, i just restarted the NAS and it is currently working again.

What are some troubleshooting options i can take? I don't want to have to restart my NAS each time i want to access my server.
I have no idea where to start since it seems to randomly occur.

 

Notes:
No logs created at time of event (couldn't identify anything in existing logs. Deleted them. Tried to access again while receiving the 502 error, and no new logs created.)
                                                          (since it is now working, i have a new set of logs created if you require the hardware detection log at all, but i doubt the main log will be useful)
Emby Version - 4.5.2.0
NAS - TerraMaster F2-210
NAS Version - 4.2.08

Link to comment
Share on other sites

CoeFamily

Thanks for the quick reply Luke, amazing service!

I have just discovered that it can be manually installed to bypass the slow TerraMaster review process and have literally just completed that upgrade.
Not sure if i should have uninstalled the old one before doing the manual install, but it seems to have worked.

Do you know if a feature may exist that caused the NAS to sleep and thus shutting down the server? Only other thing i can think of.

Link to comment
Share on other sites

CoeFamily

I have just waited a while and tried again. As before, it has randomly stopped working.

With the new update however (from 4.5.2 to 4.5.4), the Emby server opens in its own window, and is not giving me a specific error code. I suspect the issue is the same, but it just says

"*IP address* refuses to connect"

I am attaching the logs now for your view. The last few entries in embyserver.txt mention an error with a particular .mkv file, but i'm not sure if that would be the cause of the entire server failure.

Any help or ideas would be greatly appreciated.

 

EDIT:
Again, this is temporarily fixed by simply restarting the NAS.

 

embyserver.txt embyserver-63749836005.txt embyserver-63749836278.txt hardware_detection-63749833870.txt hardware_detection-63749836040.txt hardware_detection-63749836315.txt

Edited by CoeFamily
Link to comment
Share on other sites

CoeFamily

Hello,

It has been a few days and I am still receiving this "192.168.1.152 refuses to connect" error.

It is happening at least once a day (usually overnight, as i wake in the morning and the server doesn't connect) and has to be remedied by restarting the NAS.

After this mornings restart, i attempted to connect my LG Smart TV, and after successful connection and 2 minutes of looking through my media, the server crashed again, giving the same error as above.

Attached a screenshot of Emby app from my NAS, and latest 2 logs.
Similar to the previously submitted logs, nothing strongly suggests what the error may be. It just simply stops connecting.

Please help

Thanks.

 

 

EDIT
I've just opened Emby within the application manager to uninstall it and saw it was 'stopped' and simply 'starting' it works again. So for some reason, the server is just automatically stopping with no logs to say why.

Capture.JPG

hardware_detection-63750097228.txt embyserver.txt

Edited by CoeFamily
Link to comment
Share on other sites

  • 2 weeks later...
rbjtech

For a local network - there are huge latency figures on the responses - seconds as opposed to ms.

This points to something on your network not responding as it should.

If you ping 192.168.1.152 (your emby server) from a PC on the same 192.168.1.x network what response times do you get ?

Does this happen on all clients, or just the LG TV ?  If no, how is the LG connected - wired/wireless ?

Also what is IP 12x.23.25.8x - Is this your WAN IP ? 

Edited by rbjtech
Link to comment
Share on other sites

CoeFamily

Thanks for your reply. In the last 2 days I have made the switch to Plex to see if that has the same issues, but still in the testing phase for that. I can however do these tests with Emby over the weekend...

Regarding your post however...

From memory, 12x.23.25.8x, I believe was Emby's remote access IP address.

My Emby server and NAS are on the same local IP, 192.168.1.152, just different Ports (suppose that is normal?)

The NAS is wired to my WiFi router, and all devices are wirelessly connected.

You mention pinging the server... how exactly do I do that?

 

Lastly, some additional info and why I just gave up with Emby... while running tests, I removed all my photos/videos (about 30k of them) and left the 20 or so movies on there. I disabled all remote access, DNLP (I think that acronym is correct?) And automatic library scanning, and Emby worked fine.

As soon as I re-added my library of 30,000 photos n videos, the server would just crash/stop while browsing the photos, or if I didn't browse anything, would just crash overnight by itself. Crashed no matter what device I browsed on, and even crashed by itself.

While watching my NAS, I saw it peaked at like 90% memory usage before Emby crashed (while browsing... obviously can't observe overnight for when it randomly crashes), so I just assumed the app has a memory leak or something and is using too much memory and my NAS just kills the process.

Note that this seems to be a fairly common thing with my exact NAS model and people with large databases

Link to comment
Share on other sites

Hi, apologies for the delay. If you're still having an issue with the server stopping, can you please download and install the same version again from our website on top of your existing version?

https://emby.media/terramaster-server.html

Please let us know if this helps. Thanks.

Link to comment
Share on other sites

Econokiller

Same issue here. After updating HDDs in unit and starting a fresh install I get the same message. 502 Bad gateway or depending on the Emby version I get 192.168.0.165 refused to connect.

 I have tried 3 versions of Emby from the app store as well as downlaoding it from the Emby site and manually installing it.  I have tried starting the app when it was  listed as stopped I have also rebooted several times and reinstalled TOS several times all with no luck. I have installed plex in the meantime. Plex seems to be working without issues over the last 2 days. I have been through the forums and tried a few tricks. I have accessed the server through putty and tried a few recommendations from the forums but my expertise is limited in that department. There seems to be an issue for a lot of people on a lot of platforms and few finding a resolve for it. Is it a random issue with different faults causing it or?

I paid for the premiere for one month and was enjoying it prior to this issue.

I prefer Emby over plex as I found it more useful for my needs.

Thanks Gerry

F4-210 Terramaster  with 4 2TB drives

vs 4.2.08-2101111540

Emby versions tried 4.5.2.0, 4.5.4.0, 4.6.0.33, 

 

Edited by Econokiller
More info added
Link to comment
Share on other sites

4 hours ago, Econokiller said:

Same issue here. After updating HDDs in unit and starting a fresh install I get the same message. 502 Bad gateway or depending on the Emby version I get 192.168.0.165 refused to connect.

 I have tried 3 versions of Emby from the app store as well as downlaoding it from the Emby site and manually installing it.  I have tried starting the app when it was  listed as stopped I have also rebooted several times and reinstalled TOS several times all with no luck. I have installed plex in the meantime. Plex seems to be working without issues over the last 2 days. I have been through the forums and tried a few tricks. I have accessed the server through putty and tried a few recommendations from the forums but my expertise is limited in that department. There seems to be an issue for a lot of people on a lot of platforms and few finding a resolve for it. Is it a random issue with different faults causing it or?

I paid for the premiere for one month and was enjoying it prior to this issue.

I prefer Emby over plex as I found it more useful for my needs.

Thanks Gerry

F4-210 Terramaster  with 4 2TB drives

vs 4.2.08-2101111540

Emby versions tried 4.5.2.0, 4.5.4.0, 4.6.0.33, 

 

Hi, can you please try what I suggested above? Thanks.

Link to comment
Share on other sites

Econokiller

If the suggestion you are referring to were installing the ones from the link that you have posted then I'm on the right track but I just tried both the regular and beta one and I keep getting this message. "Error"

"The file is incorrect and cannot be installed"

Just for giggles I tried both the 64bit one and ARM versions both beta and the new one all with the same outcome.

Link to comment
Share on other sites

Econokiller

I just recently removed all my drives and installed a single one then proceeded to install the previous OS 4.1.3.2 and then installed emby from the app store and it booted up and connected. Shutdown re installed the original drives, rebooted with 4.2.0.8, try emby and shows that it refuses to connect.

 

I have tried downgrading the software from 4.2.... to 4.1.... and it says the OS I have is newer than the one I am trying to install. Is there a way to dial back the version without loosing all my data ??

I have applied the newest OS to my Terramaster as well as the patches with no change in emby.

I realize this is not a Terramaster forum but maybe someone has encountered it along the way.

 

Update.

I removed my 4 drives and erased everything on them, reinstalled them then proceeded with  a fresh install and when I got to the TOS load page I went manual and installed 4.1.3.2  and installed  Emby 4.5.2.0 from the app store and I have Emby back up and running for the moment I just hope this nas doesn't try and update by some fluke and set me back another day or two.

Edited by Econokiller
Update
Link to comment
Share on other sites

  • 2 weeks later...
Econokiller

So I rolled back to 4.1.3.2. TOS which involved erasing the four drives I have in my NAS and I am using EMBY 4.5.2.0 and other than a few issues with TOS EMBY has been working good so far. My assumption is the latest version of TOS has a issue with EMBY or vice versa. Nothing very helpful on either forum as far as my issue but I got it sorted out for now or until I have to update. 

P.S. I did apply the 4.1.3.2 patch to my NAS and EMBY is still working.

Link to comment
Share on other sites

Econokiller

Well I upgraded a drive on my NAS rebuilt the pool and now I am getting the old 502 Bad Gateway again. I am lost as I have done what I can with my knowledge it just seems like another boot to the nards!! Once I get it working good it decides that's not fun enough and BOOM. Anyway is there any hope on the horizon as far as this problem goes or is it still a fresh issue. I really like emby and I have tried plex but it refuses to show some content, emby was much friendlier with setting up and no issues playing anything I put to it.

Help this ol' noob ?

Link to comment
Share on other sites

Guest

Is the 502 coming from Emby Server or the NAS's Server capabilities?

Are the drives in question housing your home/or the OS? 

Link to comment
Share on other sites

Econokiller

The 502 is when I try to hit the Emby app on the nas, when I try to reach from inside my network or from the internet it says the server is not available. 

Now I have switched back to plex for the short term and hopefully there will be a update for the NAS or Emby.

Link to comment
Share on other sites

HI, would you mind trying our beta package and seeing how that compares? Thanks.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...