Jump to content

Possible Resource Leak


soniCron

Recommended Posts

soniCron

I noticed that the longer Emby runs, the more memory it uses. Okay, this could be nothing; a garbage collection thing. (It seems to cap at 1.2GB, so that's probably what it is. I dunno.)

 

However...

 

The number of open files as well as threads goes up and up and up and up for some reason. I haven't yet noticed any ill effects of this (maybe the memory is related?), but I'm not sure I'd feel comfortable leaving the server running for an extended period of time under these conditions.

 

It's not the end of the world, but it's possibly a bug worth looking into.

 

Here's files and threads over the course of a week:

 

https://i.imgur.com/bLMU6NT.png

(The dark green line is Emby)

 

The drops at the beginning of the week are restarts, and the slight drop at the end is actually all the way down, but the graph doesn't reflect it at this time scale. (All major drops back down are restarts.) There are no drops in threads and minor drops in files during the course of running.

 

A few things happen in the logs around the time this happens, however, I can't be sure of how strongly this correlates, so take it with a grain of salt:

 

First is one that seems to be looking for files that don't exist:

Warn - BaseItem: Unable to find linked item at path [blah blah blah]

I don't, nor have I ever, use symlinks or anything of the sort. The list is short (maybe 20-30 items), consistently shows the same items, and all items at locations that I use, but the files are no longer there. Perhaps the database needs to cull non-existent files?

 

 

Second thing also happens roughly the same time as the files/threads increasing:

Info - ImageProcessor: Failed to read image header for /var/lib/emby/metadata/library/[blah blah blah]/folder.jpg. Doing it the slow way.

File permissions are correct, readable by "emby" user, and the file is intact.

 

 

Third thing that happens roughly the same time:

Error - App: Error getting response from http://api.fanart.tv/webservice/newmusic/[blah blah blah]/1433534559/&client_key=[redacted]
...
Error - App: Error running postscan task
...

(Both are a 404 error to be precise.)

 

I don't have a music library. I did at one point, but no longer. Perhaps it's related to the other error in which it's looking for stuff that's since been removed..?

 

Each of these errors happen together, and it seems correlated to the memory, files, and thread count going up.

 

If there's a way to cull the database, that would be really handy. I don't know if that's it, but it seems to be the cause.

 

Hope this helps you guys keep Emby in the forefront as the BEST MEDIA SERVER EVARRRR!!!!1 :)

Link to comment
Share on other sites

gsnerf

Regarding the files/threads: there is a leak somewhere in network session handling under linux. There are some stray connections waiting to be closed until the process is closed. In result at some point the maximum number of open file handles will be reached (and propably no more connections will be possible). I've been trying to find the exact condition when this happens, but haven't been able to pinpoint it yet. As a temporary workaround: restart the server with a cron job every night.

  • Like 1
Link to comment
Share on other sites

Regarding the files/threads: there is a leak somewhere in network session handling under linux. There are some stray connections waiting to be closed until the process is closed. In result at some point the maximum number of open file handles will be reached (and propably no more connections will be possible). I've been trying to find the exact condition when this happens, but haven't been able to pinpoint it yet. As a temporary workaround: restart the server with a cron job every night.

 

we also have a restart plugin that can run on a schedule

  • Like 1
Link to comment
Share on other sites

soniCron

Thanks, guys! The solution is what I figured! :)

 

Just wanted to make sure ya were aware of it!

 

Keep up the great work, gents!  :D

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
×
×
  • Create New...