From 323e3cdf2789a3ed96c253e62e52ac9b35c0b9a3 Mon Sep 17 00:00:00 2001 From: Akihito Koriyama Date: Fri, 28 Jun 2024 06:19:10 +0900 Subject: [PATCH] Update build workflow to include fault detection and logging This revision modifies the GitHub Actions CI workflow for better failure diagnostics. It includes a timeout to the 'Run demo' step and a new step added to check for segmentation faults. It also modifies failure conditions ensuring core dumps, logs, and stderr are always displayed and uploaded as artifacts. This will greatly assist in diagnosing build issues when they occur. --- .github/workflows/build.yml | 51 ++++++++++++++++++++++++++++++------- 1 file changed, 42 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7345142..1904053 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,8 +25,8 @@ jobs: - name: Enable core dumps run: | + sudo sysctl -w kernel.core_pattern=/tmp/core-%e.%p ulimit -c unlimited - echo '/tmp/core-%e.%p' | sudo tee /proc/sys/kernel/core_pattern - name: Set PHP error logging run: | @@ -62,16 +62,24 @@ jobs: - name: Run demo run: | php -d extension=./modules/rayaop.so -i | grep rayaop - php -d extension=./modules/rayaop.so -d memory_limit=128M -d report_memleaks=1 -d zend.assertions=1 -d assert.exception=1 rayaop.php 2> php_stderr.log - continue-on-error: true + timeout 60s php -d extension=./modules/rayaop.so -d memory_limit=128M -d report_memleaks=1 -d zend.assertions=1 -d assert.exception=1 rayaop.php 2> php_stderr.log || true + + - name: Check for segmentation fault + run: | + if grep -q "Segmentation fault" php_stderr.log; then + echo "Segmentation fault detected" + cat php_stderr.log + elif dmesg | grep -q "segfault"; then + echo "Segmentation fault detected in kernel logs" + dmesg | tail -n 20 + else + echo "No segmentation fault detected" + fi + if: always() - name: Display PHP error log run: cat /tmp/php_errors.log - if: failure() - - - name: Display stderr output - run: cat php_stderr.log - if: failure() + if: always() - name: Check for core dump run: | @@ -81,4 +89,29 @@ jobs: else echo "No core dump found" fi - if: failure() + if: always() + + - name: Display core dump + run: | + for corefile in /tmp/core-*; do + echo "Processing core dump: $corefile" + gdb -q -c "$corefile" php -ex "thread apply all bt full" -ex "quit" + done + if: always() + + - name: Upload core dump + uses: actions/upload-artifact@v2 + with: + name: core-dumps + path: /tmp/core-* + if: always() + + - name: Upload logs as artifacts + uses: actions/upload-artifact@v2 + with: + name: debug-logs + path: | + /tmp/php_errors.log + php_stderr.log + if-no-files-found: warn + if: always()