forked from babelfish-for-postgresql/babelfish_extensions
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Support for Uploading Coredumps in Github Actions (babelfish-for-…
…postgresql#2148) In case of crash during the Tests run , if there is a server crash this action will create the text backtrace as well as upload the corefile as an artifact of Github action run. Example of workflow where coredump generated -https://github.com/babelfish-for-postgresql/babelfish_extensions/actions/runs/7194251970 Signed-off-by: Nirmit Shah [email protected]
- Loading branch information
1 parent
65c16ef
commit 887c8f0
Showing
15 changed files
with
136 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: 'Check for coredumps on the System' | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Create coredump summaries | ||
if: always() | ||
run: | | ||
gdb --quiet --core /var/coredumps/* --batch -ex 'info auxv' | ||
./.github/scripts/get_coredumps linux /var/coredumps | ||
ls ./*.out | ||
shell: bash | ||
|
||
|
||
|
||
- name: Upload Coredumps | ||
uses: actions/upload-artifact@v3 | ||
if: always() | ||
with: | ||
name: coredumps | ||
path: | | ||
/var/coredumps/* | ||
/home/runner/work/babelfish_extensions/babelfish_extensions/bt-* | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#! /bin/sh | ||
|
||
if [ $# -ne 2 ]; then | ||
echo "cores_backtrace.sh <os> <directory>" | ||
exit 1 | ||
fi | ||
|
||
os=$1 | ||
directory=$2 | ||
|
||
case $os in | ||
freebsd|linux|macos) | ||
;; | ||
*) | ||
echo "unsupported operating system ${os}" | ||
exit 1 | ||
;; | ||
esac | ||
|
||
first=1 | ||
for corefile in $(find "$directory" -type f -name "core*") ; do | ||
if [ "$first" -eq 1 ]; then | ||
first=0 | ||
else | ||
# to make it easier to separate the different crash reports | ||
echo -e '\n\n' | ||
fi | ||
|
||
dump_name=$(basename $corefile) | ||
|
||
if [ "$os" = 'macos' ]; then | ||
lldb -c $corefile --batch -o 'thread backtrace all' -o 'quit' | ||
else | ||
auxv=$(gdb --quiet --core ${corefile} --batch -ex 'info auxv' 2>/dev/null) | ||
if [ $? -ne 0 ]; then | ||
echo "could not process ${corefile}" | ||
continue | ||
fi | ||
|
||
if [ "$os" = 'freebsd' ]; then | ||
binary=$(echo "$auxv" | grep AT_EXECPATH | perl -pe "s/^.*\"(.*)\"\$/\$1/g") | ||
elif [ "$os" = 'linux' ]; then | ||
binary=$(echo "$auxv" | grep AT_EXECFN | perl -pe "s/^.*\"(.*)\"\$/\$1/g") | ||
else | ||
echo 'should not get here' | ||
exit 1 | ||
fi | ||
|
||
echo "dumping ${corefile} for ${binary}" | ||
gdb --batch --quiet -ex "thread apply all bt full" -ex "quit" "$binary" "$corefile" 2>/dev/null | tee "bt-$dump_name.out" | ||
# to get 0 exit code | ||
ls ./ | ||
fi | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters