basler / gst-plugin-pylon

The official GStreamer plug-in for Basler cameras
BSD 3-Clause "New" or "Revised" License
42 stars 10 forks source link

Segmentation fault (core dumped) when delete and creating pipline again with opencv VideoCapture in C++ #97

Open thanhngotud opened 8 months ago

thanhngotud commented 8 months ago

Hi, I'm using the gst-plugin-pylon with opencv VideoCapture in C++ on Jetson Xavier NX. I can open and release the camera successfully .But when i reopen the camera again, it will crash as "Segmentation fault". I did test with "videotestsrc", everything is fine. Here is my code :

int main() {

    VideoCapture cam0("pylonsrc capture-error=skip device-serial-number=40404315 ! video/x-raw, format=(string)BGR ! queue ! videoconvert ! appsink async=false",cv::CAP_GSTREAMER);
    cam0.release();
    cam0=VideoCapture("pylonsrc capture-error=skip device-serial-number=40404315 ! video/x-raw, format=(string)BGR ! queue ! videoconvert ! appsink async=false",cv::CAP_GSTREAMER);
    cam0.release();

    return 0;
}
thiesmoeller commented 7 months ago

Can you provide a gdb back trace of the issue?

thanhngotud commented 7 months ago

Here the gdb back trace

(gdb) run
Starting program: /home/aaeon/uniEdge/uniEdge_carpet_2cam/build/carpet 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/aarch64-linux-gnu/libthread_db.so.1".
[New Thread 0xffffd8571900 (LWP 37000)]
[New Thread 0xffffd7d70900 (LWP 37001)]
[New Thread 0xffffd756f900 (LWP 37002)]
[Thread 0xffffd756f900 (LWP 37002) exited]
[New Thread 0xffffd756f900 (LWP 37003)]
[Detaching after fork from child process 37004]
[New Thread 0xffffd6d6e900 (LWP 37005)]
[Thread 0xffffd756f900 (LWP 37003) exited]
[Thread 0xffffd6d6e900 (LWP 37005) exited]
[New Thread 0xffffd6d6e900 (LWP 37006)]
[Thread 0xffffd6d6e900 (LWP 37006) exited]
[New Thread 0xffffd6d6e900 (LWP 37007)]
[Detaching after fork from child process 37008]
[New Thread 0xffffd756f900 (LWP 37009)]
[Thread 0xffffd6d6e900 (LWP 37007) exited]
[Thread 0xffffd756f900 (LWP 37009) exited]
[New Thread 0xffffd756f900 (LWP 37010)]
[Thread 0xffffd756f900 (LWP 37010) exited]
[New Thread 0xffffd756f900 (LWP 37011)]
[Detaching after fork from child process 37012]
[New Thread 0xffffd6d6e900 (LWP 37013)]

(carpet:36997): GLib-GObject-CRITICAL **: 17:03:46.401: g_param_spec_int64: assertion 'default_value >= minimum && default_value <= maximum' failed

(carpet:36997): GLib-GObject-CRITICAL **: 17:03:46.402: g_param_spec_int64: assertion 'default_value >= minimum && default_value <= maximum' failed
[Thread 0xffffd756f900 (LWP 37011) exited]
[Thread 0xffffd6d6e900 (LWP 37013) exited]
[New Thread 0xffffd6d6e900 (LWP 37014)]
[Thread 0xffffd6d6e900 (LWP 37014) exited]
[New Thread 0xffffd6d6e900 (LWP 37015)]
[Detaching after fork from child process 37016]
[New Thread 0xffffd756f900 (LWP 37017)]

(carpet:36997): GLib-GObject-CRITICAL **: 17:03:46.880: g_param_spec_int64: assertion 'default_value >= minimum && default_value <= maximum' failed

(carpet:36997): GLib-GObject-CRITICAL **: 17:03:46.881: g_param_spec_int64: assertion 'default_value >= minimum && default_value <= maximum' failed
[Thread 0xffffd6d6e900 (LWP 37015) exited]
[Thread 0xffffd756f900 (LWP 37017) exited]
[New Thread 0xffffd756f900 (LWP 37018)]
[New Thread 0xffffd6d6e900 (LWP 37021)]
[Thread 0xffffd6d6e900 (LWP 37021) exited]
[New Thread 0xffffd6d6e900 (LWP 37024)]
[Detaching after fork from child process 37025]
[New Thread 0xffffd64ec900 (LWP 37026)]
[New Thread 0xffffd5ceb900 (LWP 37027)]

(carpet:36997): GStreamer-CRITICAL **: 17:03:47.754: gst_caps_get_structure: assertion 'GST_IS_CAPS (caps)' failed

(carpet:36997): GStreamer-CRITICAL **: 17:03:47.755: gst_structure_get_int: assertion 'structure != NULL' failed
[ WARN:0] global /home/ubuntu/build_opencv/opencv/modules/videoio/src/cap_gstreamer.cpp (1079) open OpenCV | GStreamer warning: cannot query video width/height

(carpet:36997): GStreamer-CRITICAL **: 17:03:47.755: gst_structure_get_fraction: assertion 'structure != NULL' failed
[ WARN:0] global /home/ubuntu/build_opencv/opencv/modules/videoio/src/cap_gstreamer.cpp (1085) open OpenCV | GStreamer warning: cannot query video fps
[ WARN:0] global /home/ubuntu/build_opencv/opencv/modules/videoio/src/cap_gstreamer.cpp (1100) open OpenCV | GStreamer warning: Cannot query video position: status=0, value=-1, duration=-1
[New Thread 0xffffd54ea900 (LWP 37028)]
[New Thread 0xffffd4ce9900 (LWP 37029)]
[New Thread 0xffffc7ffa900 (LWP 37030)]
[New Thread 0xffffbf23e900 (LWP 37031)]
[New Thread 0xffffbea3d900 (LWP 37032)]
[Thread 0xffffbf23e900 (LWP 37031) exited]
[Thread 0xffffc7ffa900 (LWP 37030) exited]
[Thread 0xffffd4ce9900 (LWP 37029) exited]
[Thread 0xffffd54ea900 (LWP 37028) exited]
[Thread 0xffffd6d6e900 (LWP 37024) exited]
[Thread 0xffffbea3d900 (LWP 37032) exited]
[Thread 0xffffd7d70900 (LWP 37001) exited]
[Thread 0xffffd8571900 (LWP 37000) exited]
Error while mapping shared library sections:
`/opt/pylon/lib': not in executable format: Is a directory
--Type <RET> for more, q to quit, c to continue without paging--q
Quit
thiesmoeller commented 7 months ago

Type bt to dump the backtrace

thanhngotud commented 7 months ago

Here are they :

Thread 1 "carpet" received signal SIGSEGV, Segmentation fault.
0x0000ffffdb979890 in gst_pylon_new (
    gstpylonsrc=gstpylonsrc@entry=0xaaaaab360a20, 
    device_user_name=<optimized out>, device_serial_number=<optimized out>, 
    device_index=<optimized out>, enable_correction=<optimized out>, 
    err=err@entry=0xffffffffe080) at ../ext/pylon/gstpylon.cpp:340
340 ../ext/pylon/gstpylon.cpp: No such file or directory.
(gdb) 
thanhngotud commented 7 months ago

@thiesmoeller , Hi could you have a look at this