FIX: Connection Pooling Resource Cleanup by bewithgaurav · Pull Request #268 · microsoft/mssql-python

Pull Request Overview

This pull request fixes connection pooling resource cleanup by preventing multiple shutdown operations and resource leaks, while also improving test isolation for pooling functionality.

  • Adds tracking of pool closure state to prevent double-cleanup operations
  • Introduces thread-safe cleanup logic that only runs once when pools are enabled
  • Adds a testing utility method to reset pooling state for better test isolation

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
mssql_python/pooling.py Implements pool closure tracking and thread-safe cleanup logic to prevent resource leaks
tests/test_009_pooling.py Comprehensive new test suite for pooling functionality including bug fix verification tests
tests/test_003_connection.py Removes pooling tests that were moved to the dedicated pooling test file

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.