Pipe: Fix potential resource leaks in pipe lifecycle cleanup#17666
Open
Caideyipi wants to merge 4 commits into
Open
Pipe: Fix potential resource leaks in pipe lifecycle cleanup#17666Caideyipi wants to merge 4 commits into
Caideyipi wants to merge 4 commits into
Conversation
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #17666 +/- ##
============================================
+ Coverage 41.40% 41.42% +0.02%
Complexity 318 318
============================================
Files 5286 5286
Lines 369547 369640 +93
Branches 47815 47848 +33
============================================
+ Hits 153008 153134 +126
+ Misses 216539 216506 -33 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
# Conflicts: # iotdb-core/datanode/src/main/java/org/apache/iotdb/db/consensus/statemachine/schemaregion/SchemaExecutionVisitor.java # iotdb-core/datanode/src/main/java/org/apache/iotdb/db/consensus/statemachine/schemaregion/SchemaRegionStateMachine.java # iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/thrift/async/IoTDBDataRegionAsyncSink.java # iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/thrift/sync/IoTDBDataRegionSyncSink.java
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
This PR fixes several potential memory/resource leaks in Pipe runtime lifecycle cleanup.
Previously, some passive paths could create or retain per-schema-region or per-pipe runtime state during leader notification, snapshot handling, queue cleanup, metric updates, pipe drop, and schema-region deletion. This could leave stale listeners, metrics, committers, rate limiters, aggregate runtime state, or floating memory counters after a pipe/schema region was closed, dropped, altered, or deleted.
Main changes:
Avoid creating schema-region pipe listeners from passive paths.
schemaListenerIfPresent(...)and use it in snapshot/load/write/delete and queue cleanup paths.SchemaRegionListeningQueueand its metrics.Cleanup stale per-pipe runtime state on pipe drop/discard.
PipeEventCommitManagercommitter and restart-time state when a pipe is dropped.Make floating memory accounting safe for late event releases.
pipeName_creationTimeinstead of relying only on livePipeMeta.Fix aggregate processor shared-state cleanup.
Tests
Added unit tests for:
PipeSchemaRegionListenerManagerTest: verifies leader state does not create listeners and unused closed listeners are cleaned up.PipeTaskAgentTest: verifies floating memory usage remains tracked after pipe drop until late release, and zero counters are cleaned after drop.This PR has:
Key changed/added classes (or packages if there are too many classes) in this PR
PipeSchemaRegionListenerManagerPipeDataNodeRuntimeAgentSchemaExecutionVisitorSchemaRegionStateMachineDataNodeRegionManagerPipeDataNodeTaskAgentPipeEventCommitManagerIoTDBSinkPipeDataNodeSinglePipeMetricsPipeTsFileToTabletsMetricsPipeTaskAgentAggregateProcessor