gstreamer-vaapi does not release X resources properly so after a short period of time X servers max_clients are reached
i have a really strange problem with gstreamer-vaapi and Ubuntu 18.04.3 LTS. My application is using libgstreamer to play h264 encoded content like mp4 and mov. This works very well with Ubuntu 16.04 with gstreamer-vaapi package installed but not with Ubuntu 18.04.
This week i got a brand new hardware and installed Ubuntu 18.04 and tried my application. For stress testing i spawned 9 instances of my application and at the beginning everything is working well (videos are playing hardware-accelerated, almost no cpu load). After round about 20 minutes there is just a black rectangle for each instance where the video should be normally played.
So after debugging a bit i figured out that X servers max_clients limit (256) is reached. I used xrestop to verify the number of active clients and it turns out that over 200 clients are active and process name of them is "unknown".
Im not sure why this setup is creating active X server clients and not cleaning them up correctly. I piped the output of "lsof -P
pidof X" into a text file and the created text file has 70Mb with a lot of vaapi entries.
When i remove gstreamer-vaapi package, my application is falling back to libva decoder and xvimagesink and no more X server clients are leaked (but hardware acceleration is not available then).
After digging a bit deeper i found Issue #106 in this gitlab. My application is also transitioning the gstreamer pipeline from PLAYING to NULL to PLAYING again and again. Maybe this issue has something to do with the behavior i can see at my end.
Can somebody help me with this problem, or point me into the right direction to fix this?
Here my system-information:
~$ cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=18.04 DISTRIB_CODENAME=bionic DISTRIB_DESCRIPTION="Ubuntu 18.04.3 LTS" ~$ dpkg -l | grep vaapi ii gstreamer1.0-vaapi:amd64 1.14.5-0ubuntu1~ubuntu18.04.1 amd64 VA-API plugins for GStreamer ~$ inxi CPU~Quad core Intel Celeron N4100 (-MCP-) speed/max~2268/2400 MHz Kernel~4.15.0-72-generic x86_64 Up~1:26 Mem~512.0/3767.3MB HDD~NA(-) Procs~199 Client~Shell inxi~2.3.56