Skip to content

Conversation

@bryancall
Copy link
Contributor

@bryancall bryancall commented Dec 11, 2025

Summary

  • Add debug logging, validation assertions, and memory poisoning to help track down intermittent heap corruption issues during cache cleanup
  • Helps diagnose issues like free(): corrupted unsorted chunks that can occur intermittently during cache test cleanup (seen in CI build #47769)

Changes

  • Add Dbg() logging with pointer address, size, and allocation type (enable with T:cache_free debug tag)
  • Add assertions to validate size is reasonable before freeing (crashes with cleaner stack trace if corrupted)
  • Add memory poisoning (0xDE pattern) in DEBUG builds before free to detect use-after-free
  • Reset raw_dir_size to 0 after freeing

Test plan

  • Build and run cache unit tests
  • Verified with ASAN enabled

Add debug logging, validation assertions, and memory poisoning to help
track down intermittent heap corruption issues during cache cleanup.

- Add Dbg() logging with pointer address, size, and allocation type
- Add assertions to validate size is reasonable before freeing
- Add memory poisoning (0xDE pattern) in DEBUG builds before free
- Reset raw_dir_size to 0 after freeing

This helps diagnose issues like "free(): corrupted unsorted chunks"
that can occur intermittently during cache test cleanup.
@bryancall bryancall self-assigned this Dec 11, 2025
@bryancall bryancall added this to the 10.2.0 milestone Dec 11, 2025
@bryancall
Copy link
Contributor Author

[approve ci centos]

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds debug instrumentation to the Stripe destructor to help diagnose intermittent heap corruption issues that occur during cache cleanup, particularly the free(): corrupted unsorted chunks errors seen in CI testing.

  • Adds debug logging with pointer address, size, and allocation type details
  • Adds validation assertions to detect corrupted size values before freeing
  • Adds memory poisoning in DEBUG builds to catch use-after-free bugs

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@bryancall bryancall requested a review from masaori335 December 15, 2025 22:40
@bryancall
Copy link
Contributor Author

[approve ci centos]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant