Jump to content

Emby Server not releasing CPU process after cancelled HW Transcode


ctaranto

Recommended Posts

ctaranto
Command line: /usr/lib/emby-server/EmbyServer.dll -programdata /var/lib/emby -ffdetect /usr/bin/ffdetect-emby -ffmpeg /usr/bin/ffmpeg-emby -ffprobe /usr/bin/ffprobe-emby -restartexitcode 3
Operating system: Linux version 5.4.89-1-MANJARO (builduser@LEGION) (gcc version 10.2.0 (GCC)) #1 SMP PREEMPT Tue Jan 12 23:39:44 UTC 2021
Framework: .NET Core 3.1.8
OS/Process: x64/x64
Runtime: usr/share/dotnet/shared/Microsoft.NETCore.App/3.1.8/System.Private.CoreLib.dll
Processor count: 8
Data path: /var/lib/emby
Application path: /usr/lib/emby-server
32 GB RAM

Emby server is configured with GPU Hardware Transcoding (nvidia 1660 Super).  It appears to be working great - without GPU HW transcoding, all CPU threads spike to 100% and the content freezes.  With GPU HW, a single CPU thread hovers around 70% and content plays great.

When I stop a movie, the CPU thread continues to run (attached is the process list).  The "white" lines are the main processes.  The green lines are threads and can be ignored.  The main process (on top) is the CPU process that shouldn't be there, as the client is no longer connected to the server.

When transcoding by CPU, the process all stop (though transcoding isn't necessarily successful since my CPU doesn't have enough oomph - i7-4790k overclocked to 4.4Ghz).

Restarting the Emby Server makes the process go away.  Until I do another HW transcode...

Any thoughts on how I can resolve this?

processes.png

Link to comment
Share on other sites

ctaranto

Hi Luke,

Small correction (that I just realized).  It's not just exiting content playing (I just tried that and the CPU process went away).

If during playback I change the bitrate (gear icon on bottom right), I will see a new ffmpeg-emby process appear (so two in total).  Exiting playback cleans up one of the ffmpeg-emby processes, but one of them remains indefinitely.

What's interesting is if I change the bitrate a few more times, there are at-most 2 processes running, and when exiting (hitting the back arrow), one process always remains.

If I re-start playback when a process is already running, another process starts.  If I change the bitrate, a 3rd process appears.  Exiting will remove one of the processes and two will remain.

Let me know if there's a log I can provide to help...

Update:  This issue seems media dependent.  One movie has the issue, the other does not.

Both have:

Video:
Title 4K HEVC
Codec HEVC
Profile Main 10
Level 153
Resolution 3840x2160
Aspect Ratio 16:9
Interlaced No
Framerate 23.976
Video Range HDR
Color Primaries bt2020
Color Space bt2020nc
Color Transfer smpte2084
Bit Depth 10 bit
Pixel Format yuv420p10le
Reference Frames 1

Audio:
Title English TRUEHD 7.1 (Default)
Language English
Codec TRUEHD
Layout 7.1
Channels 8 ch
Sample Rate 48,000 Hz
Bit Depth 24 bit
Default Yes

The one with an issue of processes hanging around when switching the playback bitrate has a video bitrate of 69,873 kbps while the one that doesn't have this issue has a bitrate of 56,424 kbps.

 

Edited by ctaranto
Link to comment
Share on other sites

ctaranto

The answer was mixed in the message above.  "...(hitting the back arrow)".  The back arrow at the top left.  This is in the web player.  Tried both edge and chrome.

Link to comment
Share on other sites

  • 1 month later...
  • 2 weeks later...

Hi, can you please attach the emby server and ffmpeg log files from when this happened? Thanks.

Link to comment
Share on other sites

ctaranto

I installed (and continually update) Emby through the Manjaro package manager using the "emby-server" package.

I don't use the browser back button - I use the on-screen back arrow.  I wasn't clear when I mentioned this above.

I also don't think it has to do with the back arrow - just changing the bit rate using the gear icon will result in two ffmpeg processes when only one should exist.  Using the on-screen back arrow will stop the ffmpeg process that is being used, but doesn't stop the ffmpeg process that shouldn't be there in the first place.

And to be clear, this doesn't happen for all media content.  It happens all the time in "Greenland" but doesn't for other movies.

Thanks...

 

Edited by ctaranto
Link to comment
Share on other sites

How are you determining that? because the log you provided shows the ffmpeg process exiting normally.

Link to comment
Share on other sites

ctaranto

Playing Greenland at 4k (auto bitrate):

image.thumb.png.b598ec5ca0baf41a7a35cd444b3f987a.png

 

 

Changing the bitrate to 1080p / 20Mpbs during playback.  Two ffmpegs:

image.thumb.png.3f3147ebdc29c8781f2ab1b13803645e.png

 

 

Exiting the playing moving using the on-screen back button.  One ffmpeg is remaining and never goes away until I restart the Emby server:

image.thumb.png.37d24e83f9e03e3b4063c33586cf7d34.png

 

 

If you need more files, let me know and I can PM them to you.

 

 

Edited by ctaranto
Link to comment
Share on other sites

9 minutes ago, Luke said:

How are you determining that? because the log you provided shows the ffmpeg process exiting normally.

The server log includes in fact one ffmpeg that hasn't ended (within the time covered by the log)

image.thumb.png.d4658ed0ed491bcb0048f1061e37c793.png

Link to comment
Share on other sites

ctaranto

What I find odd is the UUID of the ffmpeg process changes when I change bit rates.

For example, if the ffmpeg uuid when playing content at 4k is 1, and I switch bitrates to 1080p, there are then two ffmpeg process with uuid's 2 and 3.  The ffmpeg uuid of 1 is no longer there.  When I exit using the on screen back button, ffmpeg process with uuid 3 goes away.  That can be seen in the screen shots of htop I posted above, as well as the 3 transcodes that are listed by softworkz.

Edited by ctaranto
Link to comment
Share on other sites

The ffmpeg process ids are random. Each process gets a new id.

Could you please uninstall the Playback Reporting plugin, restart the server and retry?

Link to comment
Share on other sites

ctaranto

Will doing this delete the data behind the plugin?

Nevermind.  Found the backup button.

Edited by ctaranto
Link to comment
Share on other sites

Just now, ctaranto said:

Will doing this delete the data behind the plugin?

Probably not, but I can't guarantee that as I don't know the plugin.

Link to comment
Share on other sites

Happy2Play
10 minutes ago, softworkz said:
  6 minutes ago, ctaranto said:

Will doing this delete the data behind the plugin?

It has its own database, only thing affected would be stats while the plugin is not installed. 

Edited by Happy2Play
Link to comment
Share on other sites

ctaranto

I removed the plugin and restarted.  Unfortunately, it did not solve the issue.

 

Edited by ctaranto
Link to comment
Share on other sites

OK, now I to understand what's happening at least:

  • When the user changes the bitrate, the client tells the server to stop the playsession
  • ffmpeg process is stopped
  • Then, the player requests another segment (which shouldn't happen) with the parameters for the stopped playsession
  • A new ffmpeg process is created to satisfy the segment request
  • The client receives the playlist for the new playsession (with the changes bandwidth params)
  • Client requests a segment from that playlist
  • Server starts a new ffmpeg process for the that request
  • The intermediate process becomes "orphaned"

That's what's happening, I just don't know why... @Luke - any idea?

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