Files
dbbackup/quick_diagnostic.sh
Alexander Renz f9fa1fb817
All checks were successful
CI/CD / Test (push) Successful in 3m4s
CI/CD / Lint (push) Successful in 1m12s
CI/CD / Integration Tests (push) Successful in 51s
CI/CD / Native Engine Tests (push) Successful in 51s
CI/CD / Build Binary (push) Successful in 43s
CI/CD / Test Release Build (push) Successful in 1m20s
CI/CD / Release Binaries (push) Successful in 10m43s
fix: Critical panic recovery for native engine context cancellation (v5.6.1)
🚨 CRITICAL BUGFIX - Native Engine Panic

This release fixes a critical nil pointer dereference panic that occurred when:
- User pressed Ctrl+C during restore operations in TUI mode
- Context got cancelled while progress callbacks were active
- Race condition between TUI shutdown and goroutine progress updates

Files modified:
- internal/engine/native/recovery.go (NEW) - Panic recovery utilities
- internal/engine/native/postgresql.go - Panic recovery + context checks
- internal/restore/engine.go - Panic recovery for all progress callbacks
- internal/backup/engine.go - Panic recovery for database progress
- internal/tui/restore_exec.go - Safe callback handling
- internal/tui/backup_exec.go - Safe callback handling
- internal/tui/menu.go - Panic recovery for menu
- internal/tui/chain.go - 5s timeout to prevent hangs

Fixes: nil pointer dereference on Ctrl+C during restore
2026-02-03 05:11:22 +01:00

53 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
# Quick diagnostic test for the native engine hang
echo "🔍 Diagnosing Native Engine Issues"
echo "=================================="
echo ""
echo "Test 1: Check basic binary functionality..."
timeout 3s ./dbbackup_fixed --help > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo "✅ Basic functionality works"
else
echo "❌ Basic functionality broken"
exit 1
fi
echo ""
echo "Test 2: Check configuration loading..."
timeout 5s ./dbbackup_fixed --version 2>&1 | head -3
if [ $? -eq 0 ]; then
echo "✅ Configuration and version check works"
else
echo "❌ Configuration loading hangs"
exit 1
fi
echo ""
echo "Test 3: Test interactive mode with timeout (should exit quickly)..."
# Use a much shorter timeout and capture output
timeout 2s ./dbbackup_fixed interactive --auto-select=0 --auto-confirm --dry-run 2>&1 | head -10 &
PID=$!
sleep 3
if kill -0 $PID 2>/dev/null; then
echo "❌ Process still running - HANG DETECTED"
kill -9 $PID 2>/dev/null
echo " The issue is in TUI initialization or database connection"
exit 1
else
echo "✅ Process exited normally"
fi
echo ""
echo "Test 4: Check native engine without TUI..."
echo "CREATE TABLE test (id int);" | timeout 3s ./dbbackup_fixed restore single - --database=test_native --native --dry-run 2>&1 | head -5
if [ $? -eq 124 ]; then
echo "❌ Native engine hangs even without TUI"
else
echo "✅ Native engine works without TUI"
fi
echo ""
echo "🎯 Diagnostic complete!"