Skip to content

Conversation

@FabianMeiswinkel
Copy link
Member

Description

Please add an informative description that covers that changes made by the pull request and link all relevant issues.

If an SDK is being regenerated based on a new swagger spec, a link to the pull request containing these swagger spec changes has been included above.

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

Copilot AI review requested due to automatic review settings November 10, 2025 09:29
@FabianMeiswinkel FabianMeiswinkel requested a review from a team as a code owner November 10, 2025 09:29
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 comprehensive leak detection infrastructure for the Azure Cosmos SDK, enabling detection of both Cosmos client leaks and Netty resource leaks during testing. The implementation includes a new stack trace utility, client lifecycle tracking, custom Netty leak detection, and integration with TestNG test infrastructure.

Key Changes:

  • Added StackTraceUtil for capturing and formatting stack traces to aid in leak diagnosis
  • Implemented client leak tracking in RxDocumentClientImpl using a thread-safe map synchronized with staticLock
  • Created custom CosmosNettyLeakDetectorFactory to detect Netty ByteBuf leaks with detailed logging

Reviewed Changes

Copilot reviewed 44 out of 44 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
StackTraceUtil.java New utility class for capturing and formatting stack traces with comprehensive JavaDoc
RxDocumentClientImpl.java Added client lifecycle tracking with activeClients map and getActiveClientsSnapshot() API
Configs.java Added CLIENT_LEAK_DETECTION_ENABLED configuration with temporary default value requiring revert
CosmosNettyLeakDetectorFactory.java (tests and encryption) Custom Netty leak detector with TestNG listener integration for paranoid-level leak detection
TestSuiteBase.java (rx, implementation, encryption) Added @BeforeClass/@AfterClass hooks for leak detection with snapshot comparison
CosmosDiagnosticsE2ETest.java Added proper client cleanup in try-finally blocks
Multiple *-testng.xml files Registered CosmosNettyLeakDetectorFactory as TestNG listener across all test suites
KafkaCosmosTestSuiteBase.java Changed @BeforeSuite/@AfterSuite methods from static to instance
pom.xml (kafka-connect) Added Maven Central repository entry

@FabianMeiswinkel
Copy link
Member Author

/azp run java - cosmos - kafka

@FabianMeiswinkel
Copy link
Member Author

/azp run java - cosmos - spark

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

2 similar comments
@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@FabianMeiswinkel
Copy link
Member Author

/azp run java - cosmos - tests

@FabianMeiswinkel
Copy link
Member Author

/azp run java - cosmos - kafka

@FabianMeiswinkel
Copy link
Member Author

/azp run java - cosmos - spark

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

2 similar comments
@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@FabianMeiswinkel
Copy link
Member Author

/azp run java - cosmos - tests

@FabianMeiswinkel
Copy link
Member Author

/azp run java - cosmos - kafka

@FabianMeiswinkel
Copy link
Member Author

/azp run java - cosmos - spark

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

2 similar comments
@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@FabianMeiswinkel
Copy link
Member Author

/azp run java - cosmos - tests

@FabianMeiswinkel
Copy link
Member Author

/azp run java - cosmos - kafka

@FabianMeiswinkel
Copy link
Member Author

/azp run java - cosmos - spark

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

2 similar comments
@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants