All Activity
- Past hour
-
Salvadorrr joined the community
-
_Sasquatch_ joined the community
-
Silviaaaa joined the community
-
bayo2004 joined the community
-
Siivia joined the community
-
fdamd joined the community
-
NataliPe joined the community
-
shangtaishun joined the community
-
bangers joined the community
-
Razan alhanoushr joined the community
-
Emby Theme: Retro Navy & Gold (W/ Seasonal Themes)
MediaEmby1968 replied to Aleas's topic in Web App CSS
Everything is working perfectly. I have to say it's even better than what I've always had... especially in the background; before, my image only appeared in certain settings. The best theme, without a doubt, in my opinion. Just one question: when I delete a file or device from the server, this window appears (see below). How do I change that orange color to another color? Thanks and congratulations on this wonderful theme (with the added advantage that changing the color is easy). - Today
-
I know, but what shall i do with the wrong ids? The only methode i found, is to search and correct them manually (identify), including change of pictures. The rest ist hope... Btw. - For other user: if you go to imdb.com, You can extract the id from the URL. Looks like "tt1234"
-
JuJuJurassic started following Dos Attack / Hacker? Claude AI Fix.
-
So yesterday evening my emby server just died, everything I did gave me a blue spinning circle. I spent hours on it then thought I'd try AI, used Claude code in a ssh session. It found the problem, effecivly a dos from an IP address, but no one was in. I think it may be a bad client, but in the end I just blocked it at the firewall. In finding it, Claude also suggested a few things, that i got it to put in a text file, including hints for the developers. Watch out Luke, Claude is after you So I've put the text file below for you to look at , hopefully it'll help if you're ever in my situation, but it does have a few modifications that woudl have stopped the problem for the developers. It's actually quite a bit faster now too! ----- ================================================================================ EMBY SERVER PERFORMANCE ISSUE: TV SHOWS LIBRARY HANGING / 100% CPU Emby Version: 4.9.3.0 OS: Ubuntu 20.04, Kernel 5.4.0-227-generic SQLite: 3.49.2 .NET: 8.0.22 ================================================================================ SYMPTOMS -------- - Emby web UI shows a spinning loading wheel; some pages never load - CPU pegged at 100% continuously on the server (one core fully saturated) - Emby API requests from some clients time out after 30 seconds - The TV Shows library in particular refuses to load / shows a loading spinner - Other libraries (Films, Music) may continue to work normally - Issue persists after restarting Emby; CPU immediately climbs back to 100% - `top` shows the EmbyServer process at or near 100% CPU with one .NET TP Worker thread rotating between LWPs at full utilisation HOW TO IDENTIFY THE SPECIFIC QUERY CAUSING IT ---------------------------------------------- 1. Check the Emby log (/var/lib/emby/logs/embyserver.txt) for lines like: Info SqliteItemRepository: Interrupt query due to cancellation. Info ItemsService-...: http/2 Response completed after client disconnected to <CLIENT_IP>. Time: 30050ms. GET https://<HOST>/emby/Users/.../Items? ...StartIndex=150&...SortBy=SortName&IncludeItemTypes=Series&ParentId=4... If you see this repeating every ~30 seconds from the same client IP, that client is stuck in a retry loop and is hammering one specific query. 2. Identify the hot thread on Linux: ps -L -p $(pgrep EmbyServer) -o lwp,pcpu,comm --sort=-pcpu | head -5 You will see a ".NET TP Worker" thread at 90-100% CPU. ROOT CAUSE ---------- The Emby server generates the following SQL for browsing TV Shows sorted by name when a client requests page 2 (StartIndex >= 150): WITH WithAncestors AS ( SELECT itemid FROM AncestorIds2 WHERE AncestorId=3 ) SELECT count(*) OVER() AS TotalRecordCount, A.Id, A.Name, A.SortName, ... , UserDatas.IsFavorite FROM MediaItems A LEFT JOIN ( SELECT AncestorIds2.ItemId FROM AncestorIds2 JOIN ItemLinks2 ON ItemLinks2.Type=4 AND ItemLinks2.LinkedId=<tag_id> AND ItemLinks2.ItemId=AncestorIds2.AncestorId ) itemlinksexcludeinheritedtagids ON itemlinksexcludeinheritedtagids.ItemId=A.Id LEFT JOIN UserDatas ON A.UserDataKeyId=UserDatas.UserDataKeyId AND UserDatas.UserId=<uid> WHERE A.Type=6 AND itemlinksexcludeinheritedtagids.itemid IS NULL AND A.Id IN WithAncestors GROUP BY A.PresentationUniqueKey ORDER BY A.SortName COLLATE NATURALSORT ASC LIMIT 500 OFFSET 150; The problem is the combination of: 1. GROUP BY on one column (PresentationUniqueKey) 2. ORDER BY on a DIFFERENT column (SortName) using the custom NATURALSORT collation Because GROUP BY and ORDER BY use different columns, SQLite cannot satisfy the ORDER BY using any index. It must sort ALL matching rows (~600 in a typical TV library) in a temporary B-tree using the NATURALSORT comparator. 3. NATURALSORT is a custom collation implemented as a .NET managed delegate. Every comparison SQLite makes during the sort crosses the native-to-managed boundary (a P/Invoke callback). With ~600 TV series, a quicksort requires approximately 5,500 comparisons. Each managed callback takes ~5ms under a loaded .NET runtime (due to string marshalling, GC pressure, etc.). 5,500 x 5ms = ~27 seconds, which exceeds the client's 30-second timeout. 4. The count(*) OVER() window function means SQLite cannot short-circuit even when enough rows have been returned — it must see all rows before it can compute the total count. This applies equally to page 1 and page 2. WHY IT APPEARS INTERMITTENTLY ------------------------------ The query has always been slow. It becomes a visible problem when a client app gets into a retry loop: - Client requests TV Shows page 2 (StartIndex=150) - Emby starts the SQLite query - After 30 seconds the client disconnects and retries immediately - Emby calls sqlite3_interrupt() to cancel the query, logs the timeout - The cycle repeats indefinitely, pinning one CPU core continuously - Other Emby operations become slow or unresponsive due to CPU starvation The trigger is usually: a client app (e.g. Infuse, Emby for Apple TV) being left open on the TV Shows grid page. When the app reconnects (e.g. after the TV wakes from sleep) it re-fetches the library list, hits page 2, and loops. Closing the client app or blocking the retrying client IP stops the CPU load immediately. Restarting Emby alone does NOT fix it because the client reconnects and resumes retrying within seconds. HOW TO CONFIRM IT IS THIS ISSUE --------------------------------- Run this on the server while the problem is active: # 1. Show the retrying requests in the log (should repeat every ~30s): tail -f /var/lib/emby/logs/embyserver.txt | grep "StartIndex=150.*Series" # 2. Identify the hot thread: watch -n2 "ps -L -p \$(pgrep EmbyServer) -o lwp,pcpu,comm --sort=-pcpu | head -6" # 3. Confirm the query is slow in isolation (takes ~0.1s without NATURALSORT): sudo -u emby sqlite3 /var/lib/emby/data/library.db ".timer on SELECT COUNT(*) FROM MediaItems WHERE Type=6;" # Should return in <1ms. If SQLite itself is slow, check disk/IO instead. # 4. Check whether the client has stopped retrying after blocking/closing: tail -20 /var/lib/emby/logs/embyserver.txt | grep "Interrupt query" # Should show no new entries once the client is gone. WHAT DOES NOT FIX IT --------------------- - Restarting Emby (client reconnects and retries) - Adding standard SQLite indexes on (Type, SortName) — SQLite cannot use a BINARY-collated index for an ORDER BY that specifies NATURALSORT - Adding a NATURALSORT-collated index on (Type, SortName) — the GROUP BY on a different column forces a temporary sort table, bypassing the index - Removing or adding plugins (the issue is in the core SQL query builder) IMMEDIATE WORKAROUND --------------------- Block the retrying client at your firewall or router (not iptables on the Emby server — the client will still reach Emby). The IP in our case was the Apple TV / Infuse client. Once blocked, CPU drops immediately to normal. Alternatively: close/force-quit the client app that is stuck retrying. SUGGESTED FIX (for Emby developers) ------------------------------------- 1. The SQL query builder should avoid generating GROUP BY + ORDER BY on different columns simultaneously. If deduplication is needed, consider using a subquery or ROW_NUMBER() window function so that ORDER BY can operate on an indexed column using the correct collation. 2. Consider implementing NATURALSORT as a native C function registered via sqlite3_create_collation_v2() rather than as a managed .NET delegate. This would eliminate the P/Invoke callback overhead on every sort comparison, potentially reducing query time from ~30 seconds to ~100ms for a library of 600 series. 3. Consider adding a query result cache for library browse queries. The TV Shows list changes infrequently; even a 60-second cache would serve all retry attempts from a cached result and completely eliminate the CPU spike. 4. The 30-second database query timeout (cancelled via sqlite3_interrupt when the HTTP client disconnects) causes no data loss, but the retry loop it creates can make the server unusable. An exponential backoff on the client side, or a server-side per-client rate limit on identical requests, would prevent the retry storm. SERVER CHANGES MADE DURING DIAGNOSIS -------------------------------------- The following were changed on this server and should be noted if you are helping reproduce or reverting the issue: - /etc/systemd/system/emby-server.service.d/override.conf Added: After=network-online.target remote-fs.target, Wants=network-online.target Reason: Emby was starting before SMB/CIFS shares were mounted. - /etc/fstab Added nofail,x-systemd.device-timeout=30 to one share with an unreachable host; fixed a missing trailing zero on another line. - /var/lib/emby/data/library.db VACUUM was run (database shrank from 2.0GB to 1.4GB, 600MB freed). Two indexes added (these do not harm but also do not fix the root issue): CREATE INDEX idx_MediaItems_type_sortname ON MediaItems(Type, SortName); CREATE INDEX idx_MediaItems_type_topparent_sortname ON MediaItems(Type, TopParentId, SortName); CREATE INDEX idx_MediaItems_type_naturalsort_sortname ON MediaItems(Type, SortName COLLATE NATURALSORT); ANALYZE run on MediaItems. - Scheduled task trigger files (StartupTrigger removed from 3 tasks): /var/lib/emby/config/ScheduledTasks/6330ee8f-*.js (Scan media library) /var/lib/emby/config/ScheduledTasks/66ff02a8-*.js (Scan Metadata Folder) /var/lib/emby/config/ScheduledTasks/9492d30c-*.js (Refresh Guide/EPG) Reason: All three heavy tasks were firing simultaneously on every restart, causing additional CPU load on top of the query issue. ================================================================================ emby_performance_issue_forum.txt
-
@luke : hello, any update ?
-
SRT subtitles not displaying, other unknown subtitles are displaying
ebr replied to davesurfer's topic in Roku
As far as I know, this treatment of sub streams is unique to the Roku player. -
Emby premiere member unable to access Emby server on android tv, android phone and lg tv via apps.
ebr replied to sk818's topic in Android
Another quick thing to check is, if on Windows, be sure your network wasn't marked as public. It should be private. -
Emby crashing on almost every movie on Shield TV Pro
ebr replied to adnaan77's topic in Android Server
Did you read the link I provided? One may still be there but you may need to reproduce the problem to be sure.- 4 replies
-
- shield tv pro
- android
-
(and 1 more)
Tagged with:
-
Hi. We don't see or control the traffic to your server. The system has a lockout but there is nothing we can directly do about connections to your server.
-
I think my server was hacked
edvinmorales@hotmail.com replied to edvinmorales@hotmail.com's topic in General/Windows
Yesterday they attempted to hack me again, i changed all passwords and activate a pin lock too, suggest you do that, and hopefully emby does something agains hacks -
Users get access to directories they shouldn't
NicerDicer replied to NicerDicer's topic in General/Windows
@NeminemYes that's active, it's an important puzzle piece in the workflow described above. This grouping is the desired behaviour, but it should not lead to bypassing accessibility checks for entries. -
brcarls started following Next up order for new episodes/seasons
-
Emby premiere member unable to access Emby server on android tv, android phone and lg tv via apps.
Luke replied to sk818's topic in Android
Hi, the link he provided does exactly that. Did you go through it? What steps did you try based on it? -
Hi, in your movie list you can filter by titles that are missing movie db ids.
-
Hi, in order for him to best help you, can you please provide more specifics? How to Report a Problem Thanks.
-
@Luke, Any thoughts, comments or suggestions regarding my playlist issue?
-
Collections randomly lost movies but display art still shows them
zellonatious replied to zellonatious's topic in General/Windows
No -
Houfino started following CSFD scraper
-
Yes..I agree...We need a lot of CSFD and is the best.
-
Select “Continue watching episode,” but the episode listed under it doesn’t match the selected episode.
kira yamato replied to kira yamato's topic in Apple iOS / macOS
Could you please provide a timeline for fixing this bug? This really ruins my long-running series episode. I am so exhausted. With these bugs. -
SRT subtitles not displaying, other unknown subtitles are displaying
Starlionblue replied to davesurfer's topic in Roku
Just to clarify. If I swap out the Roku to an Apple TV, this would not be an issue? -
Subtitles not showing on Android for an mkv during playback
sa2000 replied to UsamaWaheed's topic in Android
@UsamaWaheedThis has been fixed in Emby for Android version 3.5.32 which is available to download and install - see https://emby.media/community/topic/95467-emby-for-android-release-notes/ -
Thank you! I have decided to go for the Beelink, as that has more RAM, an Intel CPU and in the end is more powerful, uses less power and is cheaper to buy. For Immich, I already am able to offload machine learning on my main laptop, which has an RTX 3080 16GB VRAM. That works perfectly.
-
This is an open issue with the development team. I understood that there was a workaround for the issue outlined in a post in this thread here
-
great work on this @TheGru, been kickin' the tires on aperture and noticed a couple things: Library Configuration currently doesn't consider mixed libraries that have both movies and tv, so any movies or shows from those libraries dont get considered in the recommendations. When aperture symlinks sidecar files it links them to a standardized name, but emby (or plugins like the bif generator) often create files that use the original filename, so emby doesnt recognize them as related to the differently named link to the media file. thank you for your work on this, really has the potential to add some serious functionality to the server!
-
Yes - gracenote made the corrections within 24 hours. Thanks for confirming
-
HW acceleration (decode + encode) with RK3568?
zyrorl replied to danergo's topic in Feature Requests
@Lukeany status on when it'll be available in Beta, this has been waiting for quite a long time!!!
