From 22392e770d1b672e6f51f4b0724412127afbd7e2 Mon Sep 17 00:00:00 2001 From: Lukasz Klimek <842586+lklimek@users.noreply.github.com> Date: Wed, 17 Dec 2025 12:51:10 +0100 Subject: [PATCH 1/4] build: dump core in tests --- .github/workflows/tests-rs-package.yml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests-rs-package.yml b/.github/workflows/tests-rs-package.yml index d644f2a40a0..d1c5678ba18 100644 --- a/.github/workflows/tests-rs-package.yml +++ b/.github/workflows/tests-rs-package.yml @@ -198,8 +198,17 @@ jobs: - name: Install librocksdb uses: ./.github/actions/librocksdb + - name: Configure core dumps + run: | + sudo mkdir /cores + sudo chmod 777 /cores + # Core filenames will be of the form executable.pid.timestamp: + sudo bash -c 'echo "/cores/%e.%p.%t" > /proc/sys/kernel/core_pattern' + - name: Run tests - run: RUST_MIN_STACK=16777216 cargo test --package=${{ inputs.package }} --all-features --locked + run: | + ulimit -c unlimited + RUST_MIN_STACK=16777216 cargo test --package=${{ inputs.package }} --all-features --locked env: SCCACHE_S3_KEY_PREFIX: ${{ runner.os }}/sccache/${{ runner.arch }}/linux-gnu ROCKSDB_STATIC: "/opt/rocksdb/usr/local/lib/librocksdb.a" @@ -207,6 +216,15 @@ jobs: SNAPPY_STATIC: "/usr/lib/x86_64-linux-gnu/libsnappy.a" SNAPPY_LIB_DIR: "/usr/lib/x86_64-linux-gnu" + - name: Upload core dumps + if: failure() + uses: actions/upload-artifact@v4 + with: + name: core-dumps-${{ inputs.package }} + path: | + /cores/* + if-no-files-found: ignore + check_each_feature: name: Check each feature runs-on: ubuntu-24.04 From 2f0743de4e1c43c5d03718818e5eb61b3273ac74 Mon Sep 17 00:00:00 2001 From: Lukasz Klimek <842586+lklimek@users.noreply.github.com> Date: Wed, 17 Dec 2025 13:08:37 +0100 Subject: [PATCH 2/4] build: zip core dumps --- .github/workflows/tests-rs-package.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests-rs-package.yml b/.github/workflows/tests-rs-package.yml index d1c5678ba18..ca07c15e7f6 100644 --- a/.github/workflows/tests-rs-package.yml +++ b/.github/workflows/tests-rs-package.yml @@ -216,13 +216,19 @@ jobs: SNAPPY_STATIC: "/usr/lib/x86_64-linux-gnu/libsnappy.a" SNAPPY_LIB_DIR: "/usr/lib/x86_64-linux-gnu" + # We need o zip core dumps, as they can contain invalid characters in their filenames + - name: Zip core dumps + if: failure() + run: | + zip -9 -r core-dumps.zip /cores/ || true + - name: Upload core dumps if: failure() uses: actions/upload-artifact@v4 with: name: core-dumps-${{ inputs.package }} path: | - /cores/* + core-dumps.zip if-no-files-found: ignore check_each_feature: From bcc94123429f3f59a5e5efd96d3b588fb271aaab Mon Sep 17 00:00:00 2001 From: Lukasz Klimek <842586+lklimek@users.noreply.github.com> Date: Wed, 17 Dec 2025 13:23:00 +0100 Subject: [PATCH 3/4] build: add binaries to core dump --- .github/workflows/tests-rs-package.yml | 38 ++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests-rs-package.yml b/.github/workflows/tests-rs-package.yml index ca07c15e7f6..66da7b3a09d 100644 --- a/.github/workflows/tests-rs-package.yml +++ b/.github/workflows/tests-rs-package.yml @@ -216,11 +216,41 @@ jobs: SNAPPY_STATIC: "/usr/lib/x86_64-linux-gnu/libsnappy.a" SNAPPY_LIB_DIR: "/usr/lib/x86_64-linux-gnu" - # We need o zip core dumps, as they can contain invalid characters in their filenames - - name: Zip core dumps + # Zip crash artifacts (core files + binaries) so filenames stay safe + - name: Collect crash artifacts if: failure() + env: + PACKAGE_NAME: ${{ inputs.package }} run: | - zip -9 -r core-dumps.zip /cores/ || true + set -euo pipefail + shopt -s nullglob + + if ! compgen -G "/cores/*" > /dev/null; then + echo "No core dumps were produced; skipping artifact archive." + exit 0 + fi + + ARTIFACT_DIR=crash-artifacts + rm -rf "${ARTIFACT_DIR}" + mkdir -p "${ARTIFACT_DIR}/cores" "${ARTIFACT_DIR}/binaries" + + cp -a /cores/. "${ARTIFACT_DIR}/cores/" + + BIN_PREFIX=$(echo "${PACKAGE_NAME}" | tr '-' '_') + for path in target/debug/deps/${BIN_PREFIX}-* target/debug/${BIN_PREFIX}-*; do + if [[ -f "$path" && -x "$path" ]]; then + cp -a "$path" "${ARTIFACT_DIR}/binaries/" + fi + done + + for extra in target/debug/deps/${BIN_PREFIX}-*.dSYM target/debug/${BIN_PREFIX}.dSYM \ + target/debug/deps/${BIN_PREFIX}-*.dwp target/debug/${BIN_PREFIX}.dwp; do + if [[ -e "$extra" ]]; then + cp -a "$extra" "${ARTIFACT_DIR}/binaries/" + fi + done + + (cd "${ARTIFACT_DIR}" && zip -9 -r ../core-dumps.zip .) - name: Upload core dumps if: failure() @@ -230,6 +260,8 @@ jobs: path: | core-dumps.zip if-no-files-found: ignore + retention-days: 14 + # Inspect locally with: gdb path/to/binary path/to/core check_each_feature: name: Check each feature From 3521cc9ef7cfd38c951679d3b99379f571db3632 Mon Sep 17 00:00:00 2001 From: Lukasz Klimek <842586+lklimek@users.noreply.github.com> Date: Wed, 17 Dec 2025 13:47:41 +0100 Subject: [PATCH 4/4] build: core dumps retention decrease to 3 days --- .github/workflows/tests-rs-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests-rs-package.yml b/.github/workflows/tests-rs-package.yml index 66da7b3a09d..6126df012b3 100644 --- a/.github/workflows/tests-rs-package.yml +++ b/.github/workflows/tests-rs-package.yml @@ -260,7 +260,7 @@ jobs: path: | core-dumps.zip if-no-files-found: ignore - retention-days: 14 + retention-days: 3 # Inspect locally with: gdb path/to/binary path/to/core check_each_feature: