Skip to content

Conversation

@wendigo
Copy link
Contributor

@wendigo wendigo commented Jun 27, 2025

It's enabled by default in the CI

Description

Additional context and related issues

Release notes

( ) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
(x) Release notes are required, with the following suggested text:

## Native S3, Azure FS, GCS
* Add ability to detect resource leakage in the runtime ({issue}`26087`)

@cla-bot cla-bot bot added the cla-signed label Jun 27, 2025
@wendigo wendigo force-pushed the serafin/fs-leak-detector branch 3 times, most recently from d6a8685 to d310a30 Compare June 27, 2025 10:29
@raunaqmorarka raunaqmorarka requested a review from Copilot June 27, 2025 11:07
Copy link

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 I/O stream leak detection functionality to the native filesystem. Key changes include the introduction of several LeakDetecting* wrapper classes to monitor resource usage, updates to the filesystem factory and module for conditional activation, and corresponding configuration and tests updates.

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
lib/trino-filesystem/src/main/java/io/trino/filesystem/leakdetection/TrackedLocationState.java Added state tracking with stack trace capture for leak detection.
lib/trino-filesystem/src/main/java/io/trino/filesystem/leakdetection/LeakDetecting*.java Introduced output and input stream/file wrappers incorporating leak detection.
lib/trino-filesystem-manager/src/test/java/io/trino/filesystem/manager/TestFileSystemConfig.java Updated tests to verify the new leak detection configuration.
lib/trino-filesystem-manager/src/main/java/io/trino/filesystem/manager/FileSystemModule.java Integrated leak detection based on configuration and CI environment variable.
lib/trino-filesystem-manager/src/main/java/io/trino/filesystem/manager/FileSystemConfig.java Added new configuration property to enable/disable leak detection.
Comments suppressed due to low confidence (1)

lib/trino-filesystem-manager/src/main/java/io/trino/filesystem/manager/FileSystemModule.java:169

  • [nitpick] Consider adding a comment explaining why the 'CONTINUOUS_INTEGRATION' environment variable is used to activate leak detection, so future maintainers understand this design decision.
        boolean leakDetectionEnabled = getenv("CONTINUOUS_INTEGRATION") != null;

@wendigo wendigo force-pushed the serafin/fs-leak-detector branch from d310a30 to ad2e69c Compare June 27, 2025 12:15
@wendigo wendigo changed the title Add i/o stream leak detection to the native FS Detect and close I/O leaks in the native FS implementations Jun 27, 2025
Copy link
Member

@raunaqmorarka raunaqmorarka left a comment

Choose a reason for hiding this comment

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

Nice idea

@wendigo wendigo force-pushed the serafin/fs-leak-detector branch from ad2e69c to 65e8eb5 Compare June 27, 2025 15:28
@wendigo wendigo force-pushed the serafin/fs-leak-detector branch from 65e8eb5 to 6dfa435 Compare June 27, 2025 15:30
@wendigo wendigo merged commit e9a6e61 into master Jun 27, 2025
77 checks passed
@wendigo wendigo deleted the serafin/fs-leak-detector branch June 27, 2025 16:25
@github-actions github-actions bot added this to the 477 milestone Jun 27, 2025
delegate = new TracingFileSystemFactory(tracer, delegate);

// Enable leak detection if configured or if running in a CI environment
boolean trackingDetectionEnabled = getenv("CONTINUOUS_INTEGRATION") != null;
Copy link
Member

Choose a reason for hiding this comment

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

You can make this the default for the config, allowing it to be overridden in either case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will follow up

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

Development

Successfully merging this pull request may close these issues.

5 participants