"typefind:sink" received signal SIGSEGV, Segmentation fault
Here's a python file that I'm having a segmentation fault with on Arm64 machines. I am using Oracle Linux 7 (OL is based on RHEL), and I'm having seg faults when I try to run a pipeline using the python bindings. For instance, consider this file (trial_pipeline.py).
import os, platform
import gi
import argparse
import faulthandler
gi.require_version('GLib', '2.0')
gi.require_version('Gst', '1.0')
from gi.repository import GLib, Gst
LINUX_GST_PLUGIN_PATH = '/usr/local/lib64/gstreamer-1.0'
GST_DEBUG_DUMP_DOT_DIR = os.getcwd()
def setup_gstreamer_path():
os.environ['GST_PLUGIN_PATH'] = LINUX_GST_PLUGIN_PATH
os.environ['GST_DEBUG_DUMP_DOT_DIR'] = GST_DEBUG_DUMP_DOT_DIR
os.environ['GST_DEBUG'] = '2'
def parse_launch(input_location, output_location):
if not Gst.is_initialized():
setup_gstreamer_path()
Gst.init(None)
pipeline_string = f"filesrc location={input_location} ! decodebin ! audioconvert ! wavenc ! filesink location={output_location}"
print(f"Running this pipeline: gst-launch-1.0 {pipeline_string}")
_pipe = Gst.parse_launch(pipeline_string)
_loop = GLib.MainLoop()
_pipe.set_state(Gst.State.PLAYING)
_loop.run()
if __name__ == "__main__":
faulthandler.enable()
print(f"Platform: {platform.platform()}, running on architecture: {platform.architecture()}")
print(f"Gi version = {gi.__version__}")
print(f"GLib version = {(GLib.MAJOR_VERSION, GLib.MINOR_VERSION, GLib.MICRO_VERSION)}")
print(f"Gstreamer initialized, version {Gst.version_string()}")
parser = argparse.ArgumentParser(description="This is a test program.")
parser.add_argument("input", metavar='input', type=str)
parser.add_argument("output", metavar='output', type=str)
args = parser.parse_args()
parse_launch(args.input, args.output)
This yields:
Platform: Linux-5.4.17-2136.318.7.1.el7uek.aarch64-aarch64-with-glibc2.17, running on architecture: ('64bit', '')
Gi version = 3.44.1
GLib version = (2, 56, 1)
Gstreamer initialized, version GStreamer 1.22.2
Running this pipeline: gst-launch-1.0 filesrc location=/stereo_48khz_mixed.mp3 ! decodebin ! audioconvert ! wavenc ! filesink location=/random.wav
0:00:00.062994769 2629 0x3a910f20 WARN basesrc gstbasesrc.c:3693:gst_base_src_start_complete:<filesrc0> pad not activated yet
Fatal Python error: Segmentation fault
Thread 0x0000fffcdf875b70 (most recent call first):
File "/odosvc/.local/lib64/python3.8/site-packages/gi/overrides/GLib.py", line 497 in run
File "trial_pipeline.py", line 31 in parse_launch
File "trial_pipeline.py", line 46 in <module>
Segmentation fault (core dumped)
However, if I run the pipeline in the command line:
$ gst-launch-1.0 filesrc location=/stereo_48khz_mixed.mp3 ! decodebin ! audioconvert ! wavenc ! filesink location=/random.wav
it is successful, and I do see /random.wav in my container.
When I run it with gdb, I see this backtrace:
Thread 0x0000fffce8b25b70 (most recent call first):
File "/odosvc/.local/lib64/python3.8/site-packages/gi/overrides/GLib.py", line 497 in run
File "trial_pipeline.py", line 31 in parse_launch
File "trial_pipeline.py", line 46 in <module>
Thread 2 "typefind:sink" received signal SIGSEGV, Segmentation fault.
0x0000fffce869074c in raise () from /lib64/libpthread.so.0`
The fact that I am seeing this only when I run the python bindings leads me to believe that perhaps I installed gst-python incorrectly. I compiled it from source using meson. The command for that is
cd ./gstreamer-1.22.2 && meson ./build && cd ./build && ninja && sudo ninja install
which seems to have worked well.
Any hints would be appreciated, apologies if this is a duplicate. Edit: If I use the same gstreamer install scripts in the dockerfile for the x86 image, it works without segmentation faults.