Describe the bug
Several Java wrappers can leak retained resources if native destruction throws. Native operations can also race with close(), producing use-after-free, while calls after closure may throw incidental NullPointerExceptions instead of IllegalStateException.
Steps/Code to reproduce bug
Source-level examples include HashJoin and KeyRemapping cleanup, concurrent native use and closure, and accessing wrapper metadata after closure. Audit analogous multi-resource cleaners such as HostColumnVectorCore.
Expected behavior
- Always attempt all cleanup and preserve suppressed exceptions.
- Prevent native handles from being destroyed while in use.
- Explicitly reject use after closure.
- Consolidate common cleaner behavior/naming and simplify
cleanImpl control flow where appropriate.
Environment overview (please complete the following information)
All environments; identified through source review.
Environment details
N/A.
Additional context
Follow-up to #22392, particularly the review discussions about exception-safe cleanup, close/use races, and use after close.
Describe the bug
Several Java wrappers can leak retained resources if native destruction throws. Native operations can also race with
close(), producing use-after-free, while calls after closure may throw incidentalNullPointerExceptions instead ofIllegalStateException.Steps/Code to reproduce bug
Source-level examples include
HashJoinandKeyRemappingcleanup, concurrent native use and closure, and accessing wrapper metadata after closure. Audit analogous multi-resource cleaners such asHostColumnVectorCore.Expected behavior
cleanImplcontrol flow where appropriate.Environment overview (please complete the following information)
All environments; identified through source review.
Environment details
N/A.
Additional context
Follow-up to #22392, particularly the review discussions about exception-safe cleanup, close/use races, and use after close.