Jump to content

Memory Leak 4.9.1.80


Go to solution Solved by Happy2Play,

Recommended Posts

Posted

Since 4.8 I've been able to create a reproduceable memory leak.

Emby runs on a server that I administer from a separate computer on the same network.

Using that separate computer, if I leave the server dashboard open in a browser/tab for a period of time (example 8 hours) the server will have a memory leak and max out the available ram. 

Visually, on the dashboard in the browser, when the tab/page is brought to focus, I'll see all the "Now Playing" section quickly "fast forward" through everything that was played by all users. 

The memory leak doesn't go away, and a server restart is required. 

I have not tried leaving the dashboard open in other browsers to test. The browser I'm using is Edge (chromium based) I can install and try a different browser tomorrow and see if I get the same results. 

embyserver-63897033055.txt

Posted

Hi, please try removing these plugins:

	Bulky 1.0.20.0
	Chapter API 1.4.0.0
	Episode Refresh 1.0.0.1
	Media Info 1.0.1.20
	Samsung Smart Things 1.0.0.4
	TimeLordMovies 19.8.3.1105

Then restart the server and see how things compare. Thanks.

Posted

Uninstalled those plugins. Still had a memory leak with emby using 32gb of ram after 8 hours. It hadn't fully saturated the ram, but I given the sever usually uses 2-4gb, it would appear it would've eventually filled up the rest. 

Test was done by having a client play a show, on shuffle, non-stop, while the server dashboard was left open on a computer, checking the server dashboard tab after 8 hours produces the similar results where the now playing displayed each episode in rapid succession before catching up to real time of what was playing. 

embyserver-63897093242.txt

Happy2Play
Posted (edited)
17 hours ago, CaseyP said:

Visually, on the dashboard in the browser, when the tab/page is brought to focus, I'll see all the "Now Playing" section quickly "fast forward" through everything that was played by all users.

I have seen this but have never used up all memory and currently setting at 465MB with a user watching.  Is this local or remote connection but will test leaving dashboard open on local system for 24 hours as I am sitting at 465MB with one current user.

 

@Luke@sa2000should OP change to 5 dbconnections?

2025-10-26 08:44:15.738 Info SqliteItemRepository: Initializing PooledDatabaseConnectionManager with pool size: 20
2025-10-26 08:44:15.738 Info AuthenticationRepository: Initializing PooledDatabaseConnectionManager with pool size: 5
2025-10-26 08:44:15.753 Info ActivityRepository: Initializing PooledDatabaseConnectionManager with pool size: 3

As it looks like 9 connections were closed on shutdown so about 45Gb per db cache size (cache_size=-5242880).  If I am reading this correctly.

 

Edited by Happy2Play
Posted
5 minutes ago, Happy2Play said:

I have seen this but have never used up all memory and currently setting at 465MB with a user watching.  Is this local or remote connection but will test leaving dashboard open on local system for 24 hours as I am sitting at 465MB with one current user.

 

@Luke@sa2000should OP change to 5 dbconnections?

2025-10-26 08:44:15.738 Info SqliteItemRepository: Initializing PooledDatabaseConnectionManager with pool size: 20
2025-10-26 08:44:15.738 Info AuthenticationRepository: Initializing PooledDatabaseConnectionManager with pool size: 5
2025-10-26 08:44:15.753 Info ActivityRepository: Initializing PooledDatabaseConnectionManager with pool size: 3

As it looks like 9 connections were closed on shutdown so about 45Gb per db cache size (cache_size=-5242880).  If I am reading this correctly.

 

Everything is local (Server is a headless windows 11 machine. Clients are all local, mostly nvidia shields. Test above was done via a second computer on the network running Emby Theater. The second computer is also what is keeping the server dashboard open via edge)

If I remember to close the server dashboard on the second computer, Emby can/does go weeks without chewing through the ram/needing a restart.

 

Happy2Play
Posted

@CaseyPIs that correct you have the Database cache set to 5Gb?

As the new multiple db connections now is eating up more ram.

Posted
31 minutes ago, Happy2Play said:

@CaseyPIs that correct you have the Database cache set to 5Gb?

As the new multiple db connections now is eating up more ram.

Yes, DB cache is configured to 5gb. My library.db file is 1.5gb so I wanted to make sure there was enough room for... everything 🤷‍♂️

Happy2Play
Posted (edited)
38 minutes ago, CaseyP said:

Yes, DB cache is configured to 5gb. My library.db file is 1.5gb so I wanted to make sure there was enough room for... everything 🤷‍♂️

Yes but now per new connections you could end up with 20x the db cache.  Depending on the upgrade cycle you came from as most will should be 5 not 20.

So the old way prior to 4.9 think will have negative effects on the new way.  So their needs to be new information published.

Edited by Happy2Play
Posted
14 minutes ago, Happy2Play said:

Yes but now per new connections you could end up with 20x the db cache.  Depending on the upgrade cycle you came from as most will should be 5 not 20.

So the old way prior to 4.9 think will have negative effects on the new way.  So their needs to be new information published.

I was on beta until 4.1.9.80 and jumped back to stable. 
Do we have any idea as to a sweet spot for the DB Cache? Or is that the new information that needs to be worked out/published.
 

Happy2Play
Posted
6 minutes ago, CaseyP said:

I was on beta until 4.1.9.80 and jumped back to stable. 
Do we have any idea as to a sweet spot for the DB Cache? Or is that the new information that needs to be worked out/published.
 

I tagged the two individual that should be able to answer this better as I have already asked the same question as I don't think the 1.5 to 2 times the db applies any more.  

At the same time I am just guessing here also as it could be something different.

 

Happy2Play
Posted (edited)

A follow up as I replicated this sort of as when I returned to the open tab on dashboard and looked at task manager it hit about 18Gb

image.png.415b26099cf0567f73c3b43cb5806514.png

At the same time as soon as the dashboard caught up memory returned to normalish as it was still in use. 

image.png.27a1aa53036e4af33c8cae7460ff4bac.png

So it would appear the browser tabbed dashboard is caching its entire operation in a somewhat suspended state until one looks at the open tab again.  Or at least the best way to describe it.  @Luke

 

Steps I took to reproduce

Open browser on localhost

open tab to dashboard

have client/s connect and play something

then open another tab to anywhere and leave it there

what a few hours and you should see the memory usage increase

return to dashboard tab and see session basically in fast forward and dashboard normalizes with sessions stopping and ram usage lowering.  At least in my quick and dirty test.

In the end there is something with the Dashboard operations/Now Play and being tabbed that appears to be a cause.

 

Edited by Happy2Play
  • Like 1
  • Thanks 1
Posted
20 minutes ago, Happy2Play said:

So it would appear the browser tabbed dashboard is caching its entire operation in a somewhat suspended state until one looks at the open tab again.  Or at least the best way to describe it. 

I have noticed a very odd occurance on my server where if I leave the browser open on my server and just close the rdp connection rather than fully signing off, when I sign back in I see a bunch of activity speeding by as if it's replaying sessions very quickly.

Also, on a brand new beta install, my memory usage had ballooned to 32GB after scanning libraries. After restarting it has leveled back out, but it also isn't doing anything ATM either.

Happy2Play
Posted

This only happens with the open browser on dashboard correct? 

But don't believe this behavior is actually new as I have seen this dashboard in fast forward for quite a while if I happen to be on that tab and return later even on remote connections but have never gone to the server/host and checked memory usage until now.

Posted
3 hours ago, Happy2Play said:

This only happens with the open browser on dashboard correct? 

But don't believe this behavior is actually new as I have seen this dashboard in fast forward for quite a while if I happen to be on that tab and return later even on remote connections but have never gone to the server/host and checked memory usage until now.

Correct. If there is no browser open then opening the browser and going to the dashboard is normal.

I haven't seen RAM usage spike like that again (yet). RAM uage by each emby instance definitely seems heavier than what it should be though.

Posted
17 hours ago, Happy2Play said:

As it looks like 9 connections were closed on shutdown so about 45Gb per db cache size (cache_size=-5242880).  If I am reading this correctly

Now that we have multiple connections, I would suggest a much lower value for the cache - how about trying 512Mb 

 

17 hours ago, Happy2Play said:

should OP change to 5 dbconnections

Well, since a brand new 4.9.1.xx install would be set to 5. I would recommend doing that.

Shutting down Emby Server and then editing the config\system.xml file to change the line to have value of 5 instead of 20

<MaxLibraryDbConnections>5</MaxLibraryDbConnections>

 

  • Like 1
Posted
7 hours ago, Happy2Play said:

I replicated this sort of as when I returned to the open tab on dashboard and looked at task manager it hit about 18Gb

Thanks. I will follow this up

  • Thanks 1
Posted
19 hours ago, Neminem said:

wonder if this workaround fixes the Emby / Edge issue when sleeping.

Enable, Disable Sleeping Tabs; Automatically suspend tabs in Edge

@Happy2PlayWhat do you have this set on your Microsoft Edge "edge://settings/system" setting

 

For me it appears to be set to "Save resources with sleeping tabs"

I am asking because with 3 clients playing media I have only got to 1.4Gb committed memory

Happy2Play
Posted (edited)
1 hour ago, sa2000 said:

@Happy2PlayWhat do you have this set on your Microsoft Edge "edge://settings/system" setting

 

For me it appears to be set to "Save resources with sleeping tabs"

I am asking because with 3 clients playing media I have only got to 1.4Gb committed memory

It appear to be set but per the last test I would say it did not work.

image.png.c4ca0dd7d57d810fb68a1175b8cee148.png

2025-10-28 05:19:11.013 Info SqliteUserRepository: Initializing PooledDatabaseConnectionManager with pool size: 3
2025-10-28 05:19:11.041 Info SqliteItemRepository: Initializing PooledDatabaseConnectionManager with pool size: 5
2025-10-28 05:19:11.043 Info AuthenticationRepository: Initializing PooledDatabaseConnectionManager with pool size: 5
2025-10-28 05:19:11.102 Info ActivityRepository: Initializing PooledDatabaseConnectionManager with pool size: 3


2025-10-28 05:19:14.659 Info SqliteItemRepository: Init Complete
2025-10-28 05:19:14.661 Info SqliteItemRepository: Opening sqlite connection to A:\Emby-Server\data\library.db. isReadOnly: True
2025-10-28 05:19:14.662 Info SqliteItemRepository: PRAGMA mmap_size=2147418112
2025-10-28 05:19:14.662 Info SqliteItemRepository: PRAGMA cache_size=-1048576
2025-10-28 05:19:14.662 Info SqliteItemRepository: PRAGMA page_size=4096

 

Edited by Happy2Play
  • Thanks 1
Posted (edited)
On 28/10/2025 at 12:23, Happy2Play said:

t appear to be set but per the last test I would say it did not work.

I can't get it to fail - It seems to remain active. I see in wireshark it is sending periodic requests for activitylog even though it is tabbed and not being displayed

I can see what potentially the issue would be - emby server is sending a websocket packet every 1 to 2 seconds and the more sessions the bigger the packet - but for me they are being read by Edge - i have even reduced idle detection to 5 minutes and restarted edge

For me it is remaining active as a tabbed browser session

Any thoughts how I would make it go dormant ?

 

Edited by sa2000
Posted

@Happy2PlayI have managed to get it to happen - with 2 laptops instead of loopback for the dashboard and also i made one other change for Windows System settings for Multi-tasking  to have "Show tabs from apps when snapping ot pressing Alt+Tab" to "Don't show tabs"

 

Posted

@CaseyP @Happy2Play This has now been referred to the development team

The issue does appear to be related to the notifications through websockets for the "Now Playing" sessions and it does appear that transcoded playback has much larger payload in these websocket notifications

Until this is addressed, my advice would be to have the MS Edge setting for System/Performance "Put inactive tabs to sleep after a specified amount of time" set to a high value

edge://settings/system/managePerformance

On 27/10/2025 at 08:03, Clackdor said:

I have noticed a very odd occurance on my server where if I leave the browser open on my server and just close the rdp connection rather than fully signing off, when I sign back in I see a bunch of activity speeding by as if it's replaying sessions very quickly.

Also, on a brand new beta install, my memory usage had ballooned to 32GB after scanning libraries. After restarting it has leveled back out, but it also isn't doing anything ATM either.

Is this using Microsoft Edge ? Or reproducible with Google chrome as well. If it is, please let me know the steps to go through to reproduce

Thanks

 

  • Thanks 1
Posted
36 minutes ago, sa2000 said:

Is this using Microsoft Edge ? Or reproducible with Google chrome as well. If it is, please let me know the steps to go through to reproduce

Emby is running bare-metal on windows server 2022, and yes this is with edge. I leave the desktop session signed in with edge open with the emby dashboard. Closing RDP or letting the session lock itself results in the odd behavior i noted when signing back in.

As for the high memory usage, I haven't seen that beta instance or my other installs on the same server get anywhere close to that usage again.

  • Thanks 1
PixelWizard
Posted (edited)

I have more than 5 emby servers on 4.9.1.80 and all of them have problems with ram memory... i use Fedora and Ubuntu, I have Proxmox with emby servers with 16gb of ram.

Before I used 4.8 and 4.9.1.10 and no have issue but now... is the hell.
All of my servers run out of ram, laggy and unnusable and i dont know what more i can do. Not using plugins.

First i think is machine problem, but i have 2 proxmox clusters, separetly in different places, different internet, different everything and on both my embys have problem with memory leaks, random stops and super laggy make servers unusable.

Since 4.8 i used 16gb of ram and is enough, upgraded to 4.9.1.80 and start problems, i add more ram to my servers, 64gb ... same problem out of memory... my host have 256gb of ram bro, but emby never have enough

I have exactly same issues in all my emby servers, start 1 week ago just when i upgrade them to 4.9.1.80.

Screenshot2025-11-03at10_51_09.thumb.png.078ded32af5dad5e35907b356bde7caf.pngScreenshot2025-11-03at10_52_59.thumb.png.b5ef42469fe22fffb650bf038fad03eb.png

Screenshot2025-11-03at11_01_17.thumb.png.437f35eac1bb283d3174822c0c393bcf.png

I attach a emby server log, but i think nothing interesting at all there.

embyserver-63897724800.txt

Edited by PixelWizard
Posted (edited)
7 hours ago, PixelWizard said:

have more than 5 emby servers on 4.9.1.80 and all of them have problems with ram memory... i use Fedora and Ubuntu, I have Proxmox with emby servers with 16gb of ram.

Before I used 4.8 and 4.9.1.10 and no have issue but now... is the hell.
All of my servers run out of ram, laggy and unnusable and i dont know what more i can do. Not using plugins.

First i think is machine problem, but i have 2 proxmox clusters, separetly in different places, different internet, different everything and on both my embys have problem with memory leaks, random stops and super laggy make servers unusable.

Since 4.8 i used 16gb of ram and is enough, upgraded to 4.9.1.80 and start problems, i add more ram to my servers, 64gb ... same problem out of memory... my host have 256gb of ram bro, but emby never have enough

I have exactly same issues in all my emby servers, start 1 week ago just when i upgrade them to 4.9.1.80.

Thanks for the detail

We are aware of memory use issues when scanning media libraries - more likely to occur when there are large libraries of TV / Music / Photos and the scanning of all libraries is scheduled to run through Scheduled Tasks - Most of these cases have been reported in this forum topic https://emby.media/community/index.php?/topic/142886-emby-ram-maxing-out/  - Until this is resolved, my advice would be to reduce the frequency of scheduled task "Scan Media Library" or disable it and rely on Library setting "Enable real monitoring" or do individual library scans/refreshes manually

The other seen cause of high memory is the one reported in this forum topic relating to tabbed / suspended dashboard and the continuous Now Playing updates

I suspect in your case, it is probably the library scans and you could enable debug logging and add logs to the forum topic I linked to confirm that it is to do with scanning. Logs provided would need to cover the period from launch until the time when the memory goes too high

Edited by sa2000

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...