Skip to content

Commit

Permalink
PRINT SEGFAULTS
Browse files Browse the repository at this point in the history
  • Loading branch information
pwojcikdev committed Feb 8, 2024
1 parent 124421b commit 2da08e1
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
31 changes: 29 additions & 2 deletions ci/tests/run-core-tests.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,35 @@
#!/bin/bash
set -euo pipefail
set -uo pipefail

# Enable core dumps
ulimit -c unlimited
echo '/tmp/core-%e.%p' | sudo tee /proc/sys/kernel/core_pattern

source "$(dirname "$BASH_SOURCE")/common.sh"

BUILD_DIR=${1-${PWD}}

${BUILD_DIR}/core_test$(get_exec_extension)
executable=${BUILD_DIR}/core_test$(get_exec_extension)
./"${executable}"

status=$?
if [ $status -ne 0 ]; then
echo "Test failed"

# Print location of core dump loaded from the system config
echo "Core dump location: $(cat /proc/sys/kernel/core_pattern)"

# Find the most recent core dump. Adjust the pattern as needed.
core_dump=$(find /tmp -name 'core-*' -exec ls -lt {} + | head -n 1)

ls /tmp/

if [ -n "$core_dump" ]; then
echo "Analyzing core dump: $core_dump"

# Use gdb to print the backtrace from the core dump
gdb -quiet -batch -ex "thread apply all bt full" -ex "quit" "${executable}" "${core_dump}"
else
echo "No core dump file found."
fi
fi
5 changes: 5 additions & 0 deletions nano/node/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,11 @@ nano::node::node (boost::asio::io_context & io_ctx_a, std::filesystem::path cons
block_broadcast{ network, !flags.disable_block_processor_republishing },
process_live_dispatcher{ ledger, scheduler.priority, vote_cache, websocket }
{
// Dereference invalid pointer to cause a crash
// This is a temporary measure to help diagnose a stack trace
// It will be removed once the root cause is found
std::cout << *reinterpret_cast<int *> (0x1) << std::endl;

logger.debug (nano::log::type::node, "Constructing node...");

block_broadcast.connect (block_processor);
Expand Down

0 comments on commit 2da08e1

Please sign in to comment.