Skip to content

[FEA] Harden Java native-resource cleanup and close safety #23939

Description

@rishic3

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.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    JavaAffects Java cuDF API.feature requestNew feature or requestimprovementImprovement / enhancement to an existing function

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions