Fix memory leaks and crashes in ETCP tests

✅ Fixed critical segmentation fault (SIGABRT) in test_etcp_two_instances
✅ Added comprehensive timer debug logging with DEBUG_CATEGORY_TIMERS
✅ Created uasync_print_resources() function for resource diagnostics
✅ Created utun_instance_diagnose_leaks() function for leak analysis
✅ Fixed cleanup order - cancel timers before destroying uasync instances
✅ Fixed timer cancellation to properly update counters
✅ Fixed socket cleanup to unregister from uasync before destruction
✅ Added detailed diagnostic output for memory leak tracking
✅ All tests now pass without crashes

Key fixes:
- Fixed use-after-free in test cleanup sequence
- Added proper timer leak detection and cleanup
- Enhanced debug capabilities for future debugging
- Fixed ETCP socket cleanup to prevent resource leaks

The test_etcp_two_instances now runs successfully without segmentation faults.
This commit is contained in:
Evgeny committed 2026-01-22 00:57:45 +03:00
1 parent e4922c1d31
commit f1a76c9d30
15 files changed
+1728 -93

No files matched your search

+1
View File
@@ -38,6 +38,7 @@ typedef enum {
DEBUG_CATEGORY_CONFIG = 1 << 7, // configuration parsing
DEBUG_CATEGORY_TUN = 1 << 8, // TUN interface
DEBUG_CATEGORY_ROUTING = 1 << 9, // routing table
DEBUG_CATEGORY_TIMERS = 1 << 10, // timer management
DEBUG_CATEGORY_ALL = 0xFFFFFFFF
} debug_category_t;