Jump to content

Transcoding causes Emby server restart - Memory Leak


Go to solution Solved by henriquefer,

Recommended Posts

henriquefer
Posted

I am reluctant to root my Shield. Will simply expand the internal storage help in this matter?

 

 

Expanding the internal storage does not help. I also have an SSD to expand the internal storage, mas I have to increase swap in order to allow a good experience using Shield.

 

Nvidia need to increase the amount of memory available on Shield. 3GB is a very low number comparing to the power of this machine.

Posted

Expanding the internal storage does not help. I also have an SSD to expand the internal storage, mas I have to increase swap in order to allow a good experience using Shield.

 

Nvidia need to increase the amount of memory available on Shield. 3GB is a very low number comparing to the power of this machine.

Ok, clear. Can you leave some instruction on how to root and how to increase swap?

henriquefer
Posted

Ok, clear. Can you leave some instruction on how to root and how to increase swap?

 

Yes. Of course.

 

1. You need a male-male USB cable: https://images-na.ssl-images-amazon.com/images/I/616YN8qAQLL._SX425_.jpg

2. You need a computer running Windows or Linux and install ADB (ADB is used communicate between your computer and Shield) https://www.xda-developers.com/install-adb-windows-macos-linux/.

3. Enable the "Developer Options" on your Shield (http://corochann.com/how-to-enable-developer-mode-in-android-tv-216.html).

4. Under the "Developer Options" enable USB Debugging and connect your Shield and computer using the male-male USB cable.

5. Go here: https://developer.nvidia.com/shield-developer-os-images to download the correct image for you device and follow the provided instructions. IMPORTANTE: Be sure that you have picked the correction image otherwise you will brick your Shield.

6. Then, you can run "sudo adb shell" on your computer and you are in the shell of your Shield.

7. Run the following commands to enable swap (5 GB).

swapoff /dev/block/zram0

echo 1 > /sys/block/zram0/reset

fallocate -l 5G /data/swapfile

chmod 600 /data/swapfile

mkswap /data/swapfile

swapon /data/swapfile

  • Like 1
Posted

Usually, Shield does not have a lot of free memory (3 GB is insufficient and even that, Nvidia release a new model with the same amount of RAM), but when I am running a media server with a big library, the issue becomes bigger. 

 

Usually the memory does not increase quickly. It progressively increases over time. During transcoding activities, the amount of memory required increases, and without SWAP, Shield runs out of memory and stops the transcoding or the interface becomes completely laggy. 

 

Which process is taking those huge amounts of memory? EmbyServer or ffmpeg?

henriquefer
Posted

Which process is taking those huge amounts of memory? EmbyServer or ffmpeg?

 

Here, you can see the "top" output of my Shield with Emby server on (no active play):

5dcd27752aac3_Image1.jpg

 

 

And here, there is the "top" output when I am watching a episode (remotely) that requires transcoding:

5dcd27a92af71_Image2.jpg

Posted

airplaydmr2 (whatever that is) seems to be eating a bunch of resources...

henriquefer
Posted

airplaydmr2 (whatever that is) seems to be eating a bunch of resources...

 

This is an app that allows me to use AirPlay on Shield. I installed it a coupe of days ago.

However, the issues regarding the usage of memory have already happened before the installation of this app. If you need, I can uninstall the app and share the results with you.

Posted

@@henriquefer - Thanks for the outputs. No need to end the other tasks. Operating systems tend to be lazy about releasing memory unless there is memory pressure, so in fact it's good to have some pressure because it will lead to more meaningful results. 

 

It would be awesome if you could create the same outputs once again:

  1. Right after transcoding starts (the moment you see the first picture at the client)
  2. After 1 minute
  3. After 5 minutes

Leave throttling off and use a remote client (just as before)

henriquefer
Posted

@@henriquefer - Thanks for the outputs. No need to end the other tasks. Operating systems tend to be lazy about releasing memory unless there is memory pressure, so in fact it's good to have some pressure because it will lead to more meaningful results. 

 

It would be awesome if you could create the same outputs once again:

  1. Right after transcoding starts (the moment you see the first picture at the client)
  2. After 1 minute
  3. After 5 minutes

Leave throttling off and use a remote client (just as before)

 

 

I have tested as before, and this is case (almost minute by minute):

 

Before starting:

5dcddf4cc9d23_Image.jpg

 

Start:

5dcddf65d06dd_Image1.jpg

 

5dcddf769d302_Image2.jpg

 

1 Minute:

 

5dcddfaa36644_Image3.jpg

 

5dcddfbbcfad3_Image4.jpg

 

4 Minutes:

5dcddff3e68e4_Image9.jpg

 

5dcde000a88b8_Image10.jpg

 

5 Minutes:

Some video freezing occurs on the client.

 

5dcde03b382a1_Image11.jpg

 

5dcde047e9337_Image12.jpg

 

7 Minutes:

 

5dcde07529f42_Image13.jpg

 

5dcde0863b7f3_Image14.jpg

Posted (edited)

Excellent, thanks.

 

I've put the relevant lines in order here:

 

5dcde5ab00c43_android_memory.jpg

 

The hw accelerated ffmpeg run shows in fact excessive memory usage. Probably it crashes at some point (red line) and ffmpeg is restarted using sw transcoding.

 

Would you be able to post or PM the two ffmpeg logs from this test?

Edited by softworkz
henriquefer
Posted

Excellent, thanks.

 

I've put the relevant lines in order here:

 

5dcde5ab00c43_android_memory.jpg

 

The hw accelerated ffmpeg run shows in fact excessive memory usage. Probably it crashes at some point (red line) and ffmpeg is restarted using sw transcoding.

 

Would you be able to post or PM the two ffmpeg logs from this test?

 

 

I sent you the log files via PM.

Posted

Before hw transcoding fails after 4-5 minutes, it has already transcoded half of the file.

 

I'm wondering whether it's a hard leak or whether it just doesn't have time for releasing memory.

 

What happens when you activate throttling? I would like to know whether it would fail after transcoding the same amount of video data (= about 24 minutes) or later (or not).

 

For this test you'll need to let it play, so it will take a while, but you can stop once it fails and starts sw transcoding.

henriquefer
Posted (edited)

Before hw transcoding fails after 4-5 minutes, it has already transcoded half of the file.

 

I'm wondering whether it's a hard leak or whether it just doesn't have time for releasing memory.

 

What happens when you activate throttling? I would like to know whether it would fail after transcoding the same amount of video data (= about 24 minutes) or later (or not).

 

For this test you'll need to let it play, so it will take a while, but you can stop once it fails and starts sw transcoding.

 

Hi,

 

You can find all the screenshots in attachment.

I am going to send you the log files by PM.

 

The behaviour was the same.

Arquivo.zip

Edited by henriquefer
Posted

Thanks again. That seems to be a hard memory leak. I'll try to reproduce during the next days.

 

Last question: Do you experience that behavior with all kinds of source videos or only with specific ones?

henriquefer
Posted

Thanks again. That seems to be a hard memory leak. I'll try to reproduce during the next days.

 

Last question: Do you experience that behavior with all kinds of source videos or only with specific ones?

all videos bigger than ~20 minutes (depending on bitrate) that requires transcoding.

  • 2 months later...
henriquefer
Posted

Thanks again. That seems to be a hard memory leak. I'll try to reproduce during the next days.

 

Last question: Do you experience that behavior with all kinds of source videos or only with specific ones?

Have you already be able to check this issue?

I have the last stable version of emby server for Android, and I still have this issue...

Posted

What android device are you running the server on?

Posted

Can you try our beta package and see how that compares?

henriquefer
Posted

Can you try our beta package and see how that compares?

I update to that version right now. I am going to test it in the next days. I let you know the results. Thanks

  • 3 weeks later...
henriquefer
Posted

Great, thanks !

 

 

So far, the actual version is working perfectly! Thanks.

Posted

Thanks for the feedback !

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