Why my program is crashing?

Please provide complete information as applicable to your setup.

**• Hardware Platform (Jetson / GPU): RTX 2070
**• DeepStream Version:6.3
**• TensorRT Version: TensorRT-8.6.1.6
**• NVIDIA GPU Driver Version (valid for GPU only):525.125.06
**• Issue Type( questions, new requirements, bugs): question
I just want to show an experienced eye if they can find any issue in the messages. My program is crashing every time I call a function in the constructor.

Below are the messages:
12:28:27: Starting /home/sigmind/Documents/LOCC2023_Vehicle/WC-Tegra-DS/watchcam-VA …
WATCHCAM Server MAC address::
Interface:00:00:00:00:00:00
Interface:D0:50:99:C2:C5:79
Interface:D0:50:99:C2:C5:7A
Interface:D0:50:99:C2:C5:7B
Interface:D0:50:99:C2:C5:7C
Interface:
Interface:02:42:D2:EB:49:16
Interface:7E:8C:F5:68:21:2E
Interface:3A:53:B7:52:49:6B
Interface:D6:3B:88:1B:D0:98

QIODevice::read (QFile, “:/qdarkstyle/style.qss”): device not open
Mainwindow width : 1848 and height : 1053
QPixmap::scaleHeight: Pixmap is a null pixmap
Connected to MySQL database
Initializing OCDR
Inside parameter Initialization
Before nv_ptr: 0
path to ocr:/home/sigmind/Documents/LOCC2023_Vehicle/WC-Tegra-DS/nvocr_src/bdlp_ocrnet.fp16.engineAfter nv_ptr: 0x556dccfe57b0
Inside constructor where nvocr_ptr0x556dccfe57b0
Has executed the lines before
ocr_thread QThread(0x556dcc4452f0)
QObject::moveToThread: Cannot move objects with a parent
rest API serverUrl extract from ./.cfg/server_url.txt : “”
total source no is : 1
source Id : 1
list size is >>> 227
match src : “[source0]”
enable str : “enable=0”
match disable : “enable=0”
match src : “[source1]”
enable str : “enable=1”
match enable : “enable=1”
srcId : 1
Camera list

if : “[source0]”
if : “[source1]”
defining argumentsNumber of instances ------------ 1
** WARN: <parse_dsexample:786>: Unknown key ‘batch-size’ for group [ds-example]
Original uri : /home/sigmind/Videos/Dhaka__traffic_rear_2.5x_6.mp4
after insert custom_uri : /home/sigmind/Videos/Dhaka__traffic_rear_2.5x_6.mp4
Licenses activated = 1
** WARN: <create_pipeline:2274>: Failed to set streammux properties

(watchcam-VA:256430): GLib-GObject-WARNING **: 12:28:31.415: g_object_set_is_valid_property: object class ‘GstDsDirection’ has no property named ‘full-frame’

(watchcam-VA:256430): GLib-GObject-WARNING **: 12:28:31.417: g_object_set_is_valid_property: object class ‘GstNvOpticalFlow’ has no property named ‘full-frame’
Warning: ‘input-dims’ parameter has been deprecated. Use ‘infer-dims’ instead.
Unknown or legacy key specified ‘process_mode’ for group [property]

tester-21 gst_dsexample_class_init of gstdsexample_optimized.cpp
Unknown key ‘extend’ in group in ‘line-crossing-stream-0’

(watchcam-VA:256430): GLib-GObject-WARNING **: 12:28:31.429: g_object_set_is_valid_property: object class ‘GstNvTracker’ has no property named ‘enable-batch-process’

(watchcam-VA:256430): GLib-GObject-WARNING **: 12:28:31.429: g_object_set_is_valid_property: object class ‘GstNvTracker’ has no property named ‘enable-past-frame’
Unknown or legacy key specified ‘is-classifier’ for group [property]
Warn: ‘threshold’ parameter has been deprecated. Use ‘pre-cluster-threshold’ instead.
befords0:00:07.583692378 256430 0x556dccaccf50 INFO nvinfer gstnvinfer.cpp:682:gst_nvinfer_logger:<secondary_gie_1> NvDsInferContext[UID 5]: Info from NvDsInferContextImpl::deserializeEngineAndBackend() <nvdsinfer_context_impl.cpp:1988> [UID = 5]: deserialized trt engine from :/home/sigmind/Documents/LOCC2023_Vehicle/WC-Tegra-DS/.cfg/deepstream-app/deepstream_lpr_app/models/LP/LPR/Latest2022-epoch160-fp16_b4_dGPU.engine
0:00:07.661842842 256430 0x556dccaccf50 INFO nvinfer gstnvinfer.cpp:682:gst_nvinfer_logger:<secondary_gie_1> NvDsInferContext[UID 5]: Info from NvDsInferContextImpl::generateBackendContext() <nvdsinfer_context_impl.cpp:2091> [UID = 5]: Use deserialized engine model: /home/sigmind/Documents/LOCC2023_Vehicle/WC-Tegra-DS/.cfg/deepstream-app/deepstream_lpr_app/models/LP/LPR/Latest2022-epoch160-fp16_b4_dGPU.engine
0:00:07.664871375 256430 0x556dccaccf50 INFO nvinfer gstnvinfer_impl.cpp:328:notifyLoadModelStatus:<secondary_gie_1> [UID 5]: Load new model:/home/sigmind/Documents/LOCC2023_Vehicle/WC-Tegra-DS/.cfg/deepstream-app/deepstream_lpr_app/deepstream-lpr-app/lpr_config_sgie_us.txt sucessfully
12:28:44: The program has unexpectedly finished.
12:28:44: The process was ended forcefully.
12:28:44: /home/sigmind/Documents/LOCC2023_Vehicle/WC-Tegra-DS/watchcam-VA crashed.

I have no idea, can you tell me how to reproduce the problem?

Which sample do you use? What does the crash stack look like?

You can use gdb to view, gdb --args your_app parameters

I am integrating many samples for a License plate detection application. The problem occurs when I am trying to use the NVOCDR pipeline. I am initializing the parameters in simple_inference.cpp into a worker_ocr class constructor for multi threading. The problem occurs whenever I try to initialize the parameters into a constructor. Here is my gdb backtrace report:
backtrace
#0 0x00007fffe0b6683d in () at /home/sigmind/TensorRT-8.6.1.6.Linux.x86_64-gnu.cuda-12.0/TensorRT-8.6.1.6/lib/libnvinfer.so.8
#1 0x00007fffe05a8a69 in () at /home/sigmind/TensorRT-8.6.1.6.Linux.x86_64-gnu.cuda-12.0/TensorRT-8.6.1.6/lib/libnvinfer.so.8
#2 0x00007fffe05a8b41 in () at /home/sigmind/TensorRT-8.6.1.6.Linux.x86_64-gnu.cuda-12.0/TensorRT-8.6.1.6/lib/libnvinfer.so.8
#3 0x00007fffe0b65ffd in () at /home/sigmind/TensorRT-8.6.1.6.Linux.x86_64-gnu.cuda-12.0/TensorRT-8.6.1.6/lib/libnvinfer.so.8
#4 0x00007fffe0b6626b in () at /home/sigmind/TensorRT-8.6.1.6.Linux.x86_64-gnu.cuda-12.0/TensorRT-8.6.1.6/lib/libnvinfer.so.8
#5 0x00007fffe0b5534c in () at /home/sigmind/TensorRT-8.6.1.6.Linux.x86_64-gnu.cuda-12.0/TensorRT-8.6.1.6/lib/libnvinfer.so.8
#6 0x00007fffe0b4aaf5 in () at /home/sigmind/TensorRT-8.6.1.6.Linux.x86_64-gnu.cuda-12.0/TensorRT-8.6.1.6/lib/libnvinfer.so.8
#7 0x00007fffe0ba8b04 in () at /home/sigmind/TensorRT-8.6.1.6.Linux.x86_64-gnu.cuda-12.0/TensorRT-8.6.1.6/lib/libnvinfer.so.8
#8 0x00007fffe0ba6b8b in () at /home/sigmind/TensorRT-8.6.1.6.Linux.x86_64-gnu.cuda-12.0/TensorRT-8.6.1.6/lib/libnvinfer.so.8
#9 0x00007fffe0b95caf in () at /home/sigmind/TensorRT-8.6.1.6.Linux.x86_64-gnu.cuda-12.0/TensorRT-8.6.1.6/lib/libnvinfer.so.8
#10 0x00007fffe0b98212 in () at /home/sigmind/TensorRT-8.6.1.6.Linux.x86_64-gnu.cuda-12.0/TensorRT-8.6.1.6/lib/libnvinfer.so.8
#11 0x00007fffe0b984a7 in () at /home/sigmind/TensorRT-8.6.1.6.Linux.x86_64-gnu.cuda-12.0/TensorRT-8.6.1.6/lib/libnvinfer.so.8
#12 0x00007fffe0b689c0 in () at /home/sigmind/TensorRT-8.6.1.6.Linux.x86_64-gnu.cuda-12.0/TensorRT-8.6.1.6/lib/libnvinfer.so.8
#13 0x00007fffe0b6933e in () at /home/sigmind/TensorRT-8.6.1.6.Linux.x86_64-gnu.cuda-12.0/TensorRT-8.6.1.6/lib/libnvinfer.so.8
#14 0x00007fff581959b9 in () at /opt/nvidia/deepstream/deepstream-6.3/lib/libnvds_infer.so
#15 0x00007fff5816da6d in nvdsinfer::NvDsInferContextImpl::deserializeEngineAndBackend(std::__cxx11::basic_string<char, std::char_traits, std::allocator >, int, std::shared_ptrnvdsinfer::TrtEngine&, std::unique_ptr<nvdsinfer::BackendContext, std::default_deletenvdsinfer::BackendContext >&) ()
at /opt/nvidia/deepstream/deepstream-6.3/lib/libnvds_infer.so
#16 0x00007fff5816e9c3 in nvdsinfer::NvDsInferContextImpl::generateBackendContext(_NvDsInferContextInitParams&) () at /opt/nvidia/deepstream/deepstream-6.3/lib/libnvds_infer.so
#17 0x00007fff58172cf0 in nvdsinfer::NvDsInferContextImpl::initialize(_NvDsInferContextInitParams&, void*, void ()(INvDsInferContext , unsigned int, NvDsInferLogLevel, char const*, void*)) () at /opt/nvidia/deepstream/deepstream-6.3/lib/libnvds_infer.so
#18 0x00007fff581735be in createNvDsInferContext(INvDsInferContext**, _NvDsInferContextInitParams&, void*, void ()(INvDsInferContext , unsigned int, NvDsInferLogLevel, char const*, void*)) () at /opt/nvidia/deepstream/deepstream-6.3/lib/libnvds_infer.so
#19 0x00007fff58204378 in () at /usr/lib/x86_64-linux-gnu/gstreamer-1.0/deepstream/libnvdsgst_infer.so
–Type for more, q to quit, c to continue without paging–c
#20 0x00007fffb6a53931 in () at /lib/x86_64-linux-gnu/libgstbase-1.0.so.0
#21 0x00007fffb6a53bb5 in () at /lib/x86_64-linux-gnu/libgstbase-1.0.so.0
#22 0x00007fffdcd146fb in () at /lib/x86_64-linux-gnu/libgstreamer-1.0.so.0
#23 0x00007fffdcd14e18 in gst_pad_set_active () at /lib/x86_64-linux-gnu/libgstreamer-1.0.so.0
#24 0x00007fffdccf1d25 in () at /lib/x86_64-linux-gnu/libgstreamer-1.0.so.0
#25 0x00007fffdcd04d3c in gst_iterator_fold () at /lib/x86_64-linux-gnu/libgstreamer-1.0.so.0
#26 0x00007fffdccf2546 in () at /lib/x86_64-linux-gnu/libgstreamer-1.0.so.0
#27 0x00007fffdccf455e in () at /lib/x86_64-linux-gnu/libgstreamer-1.0.so.0
#28 0x00007fffdccf47e8 in () at /lib/x86_64-linux-gnu/libgstreamer-1.0.so.0
#29 0x00007fffdccf69d2 in gst_element_change_state () at /lib/x86_64-linux-gnu/libgstreamer-1.0.so.0
#30 0x00007fffdccf7119 in () at /lib/x86_64-linux-gnu/libgstreamer-1.0.so.0
#31 0x00007fffdccd31b8 in () at /lib/x86_64-linux-gnu/libgstreamer-1.0.so.0
#32 0x00007fffdccf69d2 in gst_element_change_state () at /lib/x86_64-linux-gnu/libgstreamer-1.0.so.0
#33 0x00007fffdccf7119 in () at /lib/x86_64-linux-gnu/libgstreamer-1.0.so.0
#34 0x00007fffdccd31b8 in () at /lib/x86_64-linux-gnu/libgstreamer-1.0.so.0
#35 0x00007fffdccf69d2 in gst_element_change_state () at /lib/x86_64-linux-gnu/libgstreamer-1.0.so.0
#36 0x00007fffdccf6a1b in gst_element_change_state () at /lib/x86_64-linux-gnu/libgstreamer-1.0.so.0
#37 0x00007fffdccf7119 in () at /lib/x86_64-linux-gnu/libgstreamer-1.0.so.0
#38 0x00005555557427f8 in Deepstream_source_code::constructorDeepStream() (this=0x55559bec1ce0) at deepstream_source_code.cpp:364
#39 0x0000555555743304 in Deepstream_source_code::startDeepStream() (this=0x55559bec1ce0) at deepstream_source_code.cpp:593
#40 0x0000555555feca8b in Deepstream_source_code::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) (_o=0x55559bec1ce0, _c=QMetaObject::InvokeMetaMethod, _id=2, _a=0x7fff34002af0) at moc_deepstream_source_code.cpp:101
#41 0x00007fffdb6bbc2a in QObject::event(QEvent*) () at /lib/x86_64-linux-gnu/libQt5Core.so.5
#42 0x00007fffdc2e7a66 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#43 0x00007fffdc2f10f0 in QApplication::notify(QObject*, QEvent*) () at /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#44 0x00007fffdb68f80a in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /lib/x86_64-linux-gnu/libQt5Core.so.5
#45 0x00007fffdb692488 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () at /lib/x86_64-linux-gnu/libQt5Core.so.5
#46 0x00007fffdb6e7e37 in () at /lib/x86_64-linux-gnu/libQt5Core.so.5
#47 0x00007fffdcb5a17d in g_main_context_dispatch () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#48 0x00007fffdcb5a400 in () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#49 0x00007fffdcb5a4a3 in g_main_context_iteration () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#50 0x00007fffdb6e7435 in QEventDispatcherGlib::processEvents(QFlagsQEventLoop::ProcessEventsFlag) () at /lib/x86_64-linux-gnu/libQt5Core.so.5
#51 0x00007fffdb68e3ab in QEventLoop::exec(QFlagsQEventLoop::ProcessEventsFlag) () at /lib/x86_64-linux-gnu/libQt5Core.so.5
#52 0x00007fffdb696116 in QCoreApplication::exec() () at /lib/x86_64-linux-gnu/libQt5Core.so.5
#53 0x000055555564773a in main(int, char**) (argc=1, argv=0x7fffffffd938) at main.cpp:88

Here is my worker_ocr.cpp file . Not using the initialize_nvOCDR() function right now. Have created a separate class to see if it would solve the problem.

include “worker_ocr.h”

include
include

include “simple_inference.cpp”

Worker_ocr::Worker_ocr():
_working(false),
nvocdrInitializer( “/home/sigmind/Documents/LOCC2023_Vehicle/WC-Tegra-DS/nvocr_src/bdlp_ocrnet.fp16.engine”, “/home/sigmind/Documents/LOCC2023_Vehicle/WC-Tegra-DS/nvocr_src/characters_list.txt”)
{

nvocr_ptr= nvocdrInitializer.getNvOCDRPtr();
qDebug()<<"See it:"<<nvocr_ptr;

}

void Worker_ocr::requestWork()
{
mutex.lock();
_working = true;
_abort = false;
qDebug()<<"Request worker start in Thread "<<thread()->currentThreadId();
mutex.unlock();

emit workRequested();

}
// Initialize the nvOCDR library and return the initialized pointer
nvOCDRp Worker_ocr::initialize_nvOCDR() {
// Init the nvOCDR lib
// Please pay attention to the following parameters. You may need to change them according to different models.

try{
    param.input_data_format = NHWC;
    param.ocrnet_trt_engine_path = (char *)"/home/sigmind/Documents/LOCC2023_Vehicle/WC-Tegra-DS/nvocr_src/bdlp_ocrnet.fp16.engine";
    param.ocrnet_dict_file = (char *)"/home/sigmind/Documents/LOCC2023_Vehicle/WC-Tegra-DS/nvocr_src/characters_list.txt";
    param.ocrnet_infer_input_shape[0] = 1;
    param.ocrnet_infer_input_shape[1] = 64;
    param.ocrnet_infer_input_shape[2] = 200;
    param.ocrnet_decode = Attention;

    std::cout<< "Inside parameter Initialization"<<std::endl;

    return nvOCDR_init(param);
}
catch (const std::exception& e) {
    std::cerr << "Error initializing nvOCDR: " << e.what() << std::endl;
    return nullptr; // Return nullptr indicating failure
}

}

void Worker_ocr::abort()
{
/mutex.lock();
if (_working) {
_abort = true;
qDebug()<<"Request worker aborting in Thread "<<thread()->currentThreadId();
}
mutex.unlock();
/
}

void Worker_ocr::doWork(cv::Mat img)
{
qDebug()<<“Inside doWork function”;
mutex.lock();
_working = true;
mutex.unlock();

nvocr_ptr= nvocdrInitializer.getNvOCDRPtr();
qDebug()<<"See it:"<<nvocr_ptr;
//nvocr_ptr = initialize_nvOCDR();
// Checks if the process should be aborted
qDebug()<<"nvocr_ptr from worker_ocr"<<nvocr_ptr;
cv::Mat image_recieved= img;
qDebug() << "Starting worker process in Thread " << thread()->currentThreadId();

// Checks if the received image is empty
if (img.empty()) {
    qDebug() << "Received image is empty";
    return; // Exit the function early
}
else{
    qDebug() << "Received image is here";
}


// Perform OCR using nvOCDR pointer
char* up_text = ocr(image_recieved, nvocr_ptr);
if (up_text && up_text[0] != '\0') {
    // Non-empty text
    qDebug() << "Received text: " << up_text;
} else {
    // Empty text
    qDebug() << "No text extracted or empty text received";
}
qDebug()<<"up_text from worker_ocr:"<< up_text;
QString ocr_data= "ocr_data,"+lpr_id_string;
dataMap.insert(ocr_data,QVariant::fromValue<QString>(QString::fromUtf8(up_text)));
qDebug() << "Worker process finished in Thread " << thread()->currentThreadId();
emit ocr_text(up_text);

// Set _working to false, meaning the process can't be aborted anymore.
mutex.lock();
_working = false;
mutex.unlock();


emit finished();

}

/Worker_ocr::~Worker_ocr() {
// Deallocate memory associated with nvOCDR
nvOCDR_deinit(nvocr_ptr);
}
/

Just from the code, I can’t see where the problem is. Did you call a virtual function in the constructor?

No. I didn’t. Turned out my model .engine files where suddenly corrupted. I rebuilt the .engine file. Now qt is giving me assertion errors where there wasn’t any error previously.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.