Crash report

In case of a firmware crash, OAK cameras will automatically generate a crash report and store it in the device. The crash report contains information about the crash, such as the stack trace, the device’s configuration, and the device’s state at the time of the crash. The crash report can be read from the device and sent to Luxonis for debugging purposes.

Demo

In case a crash report was found on the device, this example will read it and save it to a json file:

> python crash_report.py
Crash dump found on your device!
Saved to crashDump_0_184430102163DB0F00_3575b77f20e796b4e79953bf3d2ba22f0416ee8b.json
Please report to developers!

Please send the crash reports together with an MRE (DepthAI issue) to our Discuss Forum. Thank you!

Setup

Please run the install script to download all required dependencies. Please note that this script must be ran from git context, so you have to download the depthai-python repository first and then run the script

git clone https://github.com/luxonis/depthai-python.git
cd depthai-python/examples
python3 install_requirements.py

For additional information, please follow installation guide

Source code

Also available on GitHub

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env python3

import cv2
import depthai as dai
from json import dump
from os.path import exists

# Connect to device and start pipeline
with dai.Device() as device:

    if device.hasCrashDump():
        crashDump = device.getCrashDump()
        commitHash = crashDump.depthaiCommitHash
        deviceId = crashDump.deviceId

        json = crashDump.serializeToJson()
        
        i = -1
        while True:
            i += 1
            destPath = "crashDump_" + str(i) + "_" + deviceId + "_" + commitHash + ".json"
            if exists(destPath):
                continue

            with open(destPath, 'w', encoding='utf-8') as f:
                dump(json, f, ensure_ascii=False, indent=4)

            print("Crash dump found on your device!")
            print(f"Saved to {destPath}")
            print("Please report to developers!")
            break
    else:
        print("There was no crash dump found on your device!")

Also available on GitHub

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <fstream>
#include <iostream>

// Includes common necessary includes for development using depthai library
#include "depthai/depthai.hpp"

static bool fileExists(dai::Path path) {
    std::ifstream file(path);
    return file.is_open();
}

int main() {
    using namespace std;

    // Connect to device and start pipeline
    dai::Device device;
    if(device.hasCrashDump()) {
        auto crashDump = device.getCrashDump();
        std::string commitHash = crashDump.depthaiCommitHash;
        std::string deviceId = crashDump.deviceId;

        auto json = crashDump.serializeToJson();

        for(int i = 0;; i++) {
            dai::Path destPath = "crashDump_" + to_string(i) + "_" + deviceId + "_" + commitHash + ".json";
            if(fileExists(destPath)) continue;

            std::ofstream ob(destPath);
            ob << std::setw(4) << json << std::endl;

            std::cout << "Crash dump found on your device!" << std::endl;
            std::cout << "Saved to " << destPath.string() << std::endl;
            std::cout << "Please report to developers!" << std::endl;
            break;
        }
    } else {
        std::cout << "There was no crash dump found on your device!" << std::endl;
    }

    return 0;
}

Got questions?

Head over to Discussion Forum for technical support or any other questions you might have.