Kodi addons issues: Plex memory leak, YouTube SSLError, etc

Post Reply
sdip
Posts: 8
Joined: Mon Dec 05, 2016 2:21 am
languages_spoken: english
Has thanked: 0
Been thanked: 0
Contact:

Kodi addons issues: Plex memory leak, YouTube SSLError, etc

Unread post by sdip » Wed Feb 28, 2018 11:45 am

Hey all, first of all thanks for a great product! I've been a happy XU4 owner for quite a few years now.
Lately my setup's been a Plex server on my nas, and Kodi running Plex addon on the XU4. Running latest 4.14.22 kernel on the ubuntu image from a 8 gb eMMC.

Here stands a list of (possible) fix that should work. It may affect behavior that was not tested, implement at your own risk.

Tl;dr for Plex Memory Leak
  • on the online interface https://app.plex.tv/ -> Settings -> Network
    • Secured Connections -> set it to Disabled
      Check - Enable local network discovery (GDM)
    On the Plex addon Settings -> Advanced
    • Allow Insecure Connections - On Same Network
      Check - Server Discovery (GDM)
Tl;dr for YouTube SSLError
wget http://archive.ubuntu.com/ubuntu/pool/m ... -1_all.deb
wget http://turul.canonical.com/pool/main/p/ ... _armhf.deb
wget http://archive.ubuntu.com/ubuntu/pool/m ... -3_all.deb
wget http://http.us.debian.org/debian/pool/m ... -1_all.deb
wget http://http.us.debian.org/debian/pool/m ... -1_all.deb
wget http://http.us.debian.org/debian/pool/m ... _armhf.deb
wget http://ftp.br.debian.org/debian/pool/ma ... -1_all.deb
wget http://ftp.br.debian.org/debian/pool/ma ... -1_all.deb
wget http://ftp.br.debian.org/debian/pool/ma ... -1_all.deb
wget http://archive.ubuntu.com/ubuntu/pool/u ... -1_all.deb
wget http://ftp.br.debian.org/debian/pool/ma ... -1_all.deb
wget http://http.us.debian.org/debian/pool/m ... _armhf.deb
sudo dpkg -i --force-breaks *.deb
sudo dpkg --configure --force-breaks python-cryptography python-openssl python3-cryptography python3-openssl
sudo apt -f install

EDIT: Changed subject from "Kodi and Plex addon memory leak" to "Kodi addons issues: Plex memory leak, YouTube SSLError, etc"
Last edited by sdip on Sun Mar 04, 2018 2:06 am, edited 5 times in total.

sdip
Posts: 8
Joined: Mon Dec 05, 2016 2:21 am
languages_spoken: english
Has thanked: 0
Been thanked: 0
Contact:

Debugging

Unread post by sdip » Wed Feb 28, 2018 1:13 pm

Plex addon memory leak
  • Description and debugging
    There's a weird issue when starting videos on Plex at Original Quality.
    Sometimes memory gets drained until about 1.4GB of 2GB taken, then drops to ~550mb and video starts playing.
    Most times though, the leak continues until RAM is exhausted, while the loading circles spin. A 1GB swap file is useless, as it would eventually fill up too.

    If I set it up to 4mbps/720p quality, the stream starts quickly, without gobling up the entire memory.
    Seems like pressing the stop button once the video's been rolling will also cause the memory to grow 'til 1.4GB before video stops and mem released.

    May be a known Plex Media Server - SSL issue: https://forums.plex.tv/discussion/29809 ... d-error/p2

    Excerpt from kodi debug log:
    21:41:42.656 T:2630873856 ERROR: _________________________________________________________________________________
    21:41:42.656 T:2630873856 ERROR: script.plex: ERROR:
    21:41:42.656 T:2630873856 ERROR: Traceback (most recent call last):
    21:41:42.656 T:2630873856 ERROR: File "/home/odroid/.kodi/addons/script.plex/lib/_included_packages/plexnet/plexserver.py", line 172, in query
    21:41:42.656 T:2630873856 ERROR: response = method(url, **kwargs)
    21:41:42.656 T:2630873856 ERROR: File "/home/odroid/.kodi/addons/script.module.requests/lib/requests/sessions.py", line 521, in get
    21:41:42.656 T:2630873856 ERROR: return self.request('GET', url, **kwargs)
    21:41:42.656 T:2630873856 ERROR: File "/home/odroid/.kodi/addons/script.module.requests/lib/requests/sessions.py", line 508, in request
    21:41:42.656 T:2630873856 ERROR: resp = self.send(prep, **send_kwargs)
    21:41:42.657 T:2630873856 ERROR: File "/home/odroid/.kodi/addons/script.module.requests/lib/requests/sessions.py", line 618, in send
    21:41:42.657 T:2630873856 ERROR: r = adapter.send(request, **kwargs)
    21:41:42.657 T:2630873856 ERROR: File "/home/odroid/.kodi/addons/script.module.requests/lib/requests/adapters.py", line 506, in send
    21:41:42.657 T:2630873856 ERROR: raise SSLError(e, request=request)
    21:41:42.657 T:2630873856 ERROR: SSLError: AsyncHTTPSConnectionPool(host='192-168-0-99.longhexhere.plex.direct', port=32400): Max retries exceeded with url: /playlists/all?playlistType=audio&X-Plex-Container-Si
    ze=10&X-Plex-Container-Start=0&X-Plex-Token=longhexhere (Caused by SSLError(SSLError('bad handshake: SysCallError(0, None)',),))
    21:41:42.657 T:2630873856 ERROR: _________________________________________________________________________________
    This is followed by repeated video codec entries, which might eat up RAM:
    21:42:02.629 T:2468889344 NOTICE: Opening stream: 2 source: 256
    21:42:02.640 T:2378167040 NOTICE: Creating audio stream (codec id: 86057, channels: 6, sample rate: 48000, no pass-through)
    21:42:02.655 T:2361389824 ERROR: CLinuxV4l2Sink::QueueBuffer - Error queueing buffer. Device s5p-mfc-dec, Type 10, Memory 1. Buffer 1, errno 5
    21:42:02.655 T:2361389824 ERROR: CDVDVideoCodecMFC::Reset - Codec Reset. Reinitializing
    21:42:02.856 T:2361389824 NOTICE: CDVDVideoCodecMFC::Open - MFC Setup succesfull (1920x1080, linesize 1920, format 0x32314d4e), start streaming
    21:42:02.884 T:2361389824 ERROR: CLinuxV4l2Sink::QueueBuffer - Error queueing buffer. Device s5p-mfc-dec, Type 10, Memory 1. Buffer 1, errno 5
    21:42:02.884 T:2361389824 ERROR: CDVDVideoCodecMFC::Reset - Codec Reset. Reinitializing
    21:42:02.904 T:2955932416 NOTICE: PulseAudio: Opened device alsa_output.usb-Creative_Technology_Ltd_SB_X-Fi_Surround_5.1_Pro_000001sF-00.analog-surround-51 in pcm mode with Buffersize 150 ms
    21:42:03.040 T:2361389824 NOTICE: CDVDVideoCodecMFC::Open - MFC Setup succesfull (1920x1080, linesize 1920, format 0x32314d4e), start streaming
    21:42:03.067 T:2361389824 ERROR: CLinuxV4l2Sink::QueueBuffer - Error queueing buffer. Device s5p-mfc-dec, Type 10, Memory 1. Buffer 1, errno 5
    21:42:03.067 T:2361389824 ERROR: CDVDVideoCodecMFC::Reset - Codec Reset. Reinitializing
    Failed workarounds:
    • web interface Secured Connections -> Preferred
      downgrading plex media server to v1.9.7
Youtube SSLError
  • I've then noticed the same SSLError on YouTube addon, so I digged some more. Turns out python crypto packages are very old on 16.04 repos. Updating them seems to fix the error so far.
Last edited by sdip on Sun Mar 04, 2018 1:43 am, edited 5 times in total.

User avatar
rooted
Posts: 6453
Joined: Fri Dec 19, 2014 9:12 am
languages_spoken: english
Location: Gulf of Mexico, US
Has thanked: 7 times
Been thanked: 4 times
Contact:

Re: Kodi and Plex addon memory leak

Unread post by rooted » Wed Feb 28, 2018 2:11 pm

Nice work on debugging the issue, I love it when someone asks a question and continues working the problem.

sdip
Posts: 8
Joined: Mon Dec 05, 2016 2:21 am
languages_spoken: english
Has thanked: 0
Been thanked: 0
Contact:

Re: Kodi and Plex addon memory leak

Unread post by sdip » Wed Feb 28, 2018 2:46 pm

rooted wrote:Nice work on debugging the issue, I love it when someone asks a question and continues working the problem.
Thanks! It pissed me off for a while, finally had time to work on it.

User avatar
odroid
Site Admin
Posts: 30322
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 4 times
Been thanked: 29 times
Contact:

Re: Kodi and Plex addon memory leak

Unread post by odroid » Fri Mar 02, 2018 1:55 pm

Really appreciate your help.
We've added the solution to our WiKi pages.
https://wiki.odroid.com/odroid-xu4/soft ... leshooting
https://wiki.odroid.com/odroid-xu4/soft ... leshooting

sdip
Posts: 8
Joined: Mon Dec 05, 2016 2:21 am
languages_spoken: english
Has thanked: 0
Been thanked: 0
Contact:

Re: Kodi and Plex addon memory leak

Unread post by sdip » Sun Mar 04, 2018 1:36 am

odroid wrote:Really appreciate your help.
We've added the solution to our WiKi pages.
https://wiki.odroid.com/odroid-xu4/soft ... leshooting
https://wiki.odroid.com/odroid-xu4/soft ... leshooting
Hey odroid, I've edited the posts to avoid confusion. You ended up picking the not working fix for the wikis, my bad.

Not working:
Secured Connections -> set it back to Preferred
Working
Secured Connections -> set it back to Disabled

User avatar
odroid
Site Admin
Posts: 30322
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 4 times
Been thanked: 29 times
Contact:

Re: Kodi addons issues: Plex memory leak, YouTube SSLError,

Unread post by odroid » Mon Mar 05, 2018 10:33 am

Thank you! WiKi has been updated.

Post Reply

Return to “Issues”

Who is online

Users browsing this forum: No registered users and 5 guests