Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use cirunner to capture and analyze GitHub action CI crash #4288

Draft
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

bennylp
Copy link
Member

@bennylp bennylp commented Feb 4, 2025

Handling of crashes in GitHub action, courtesy of https://github.com/pjsip/cirunner.

When a crash is detected, the following will be performed:

  • crash dump analysis is printed
  • the program, core dump, and PDB file on Windows will be uploaded as action artifact, which can be downloaded for offline analysis.

Scope

Scope of this PR:

  • modified action yml files:
    • run test programs with cirunner.py
    • add handler step to upload artifacts (if present) on failure
  • removed capturing signal and printing stack backtrace from main.c because it's no longer working on Linux and could cause core dump not to be written if we forgot to specify -n

Analyzing the core dump locally

With Visual Studio (Windows)

Source level crash debugging is available with VS (tested with VS 2015).

Note:

  • make sure your source version is the same as the repository.
  • heap memory values are not available because we use minidump

Steps:

  • Download and extract the artifact zip file somewhere (download artifact from this run for a sample). It should contain three files: .exe, .dmp, and .pdb.
  • Launch Visual Studio. Open the .dmp file
  • Click Debug with Native only
  • Find the location of the source file when asked

With Visual Studio Code (Linux, Mac)

Source level crash debugging is available with VS Code (ested on Linux. Mac would probably work (with lldb debugger)).

Note:

  • make sure your source file version is the same as the repository.
  • for Linux, heap memory values are not available

Download the artifact zip to a linux machine, extract somewhere (e.g. download sample artifact from this run).

Use the following as template for your launch.json. The important keys are:

  • program
  • coreDumpPath
  • sourceFileMap
    {
        "name": "coredump",
        "type": "cppdbg",
        "request": "launch",
        "program": "/path/to/artifact/pjsip-test-x86_64-unknown-linux-gnu",
        "coreDumpPath": "/path/to/artifact//core.6469",
        "cwd": "does not matter?",
        "sourceFileMap": {
            "/home/runner/work/pjproject/pjproject": "/your/source/to/project/pjproject"
        },
        "environment": [
            {
                "name": "LD_LIBRARY_PATH",
                "value": "/additional/dll/such/as/openh264"
            }
        ]
    },

Linux with gdb

  1. download the artifact zip to a linux machine, extract somewhere (e.g. download sample artifact from this run)
  2. if the crashed program is pjlib-test, change directory to pjproject/pjlib/bin,
    if the crashed program is pjsip-test, change directory to pjproject/pjsip/bin,
    etc.
  3. run gdb:
    $ gdb /path/to/pjsip-test /path/to/core.12345
    

@bennylp bennylp marked this pull request as draft February 4, 2025 07:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant