fix(aiomysql): avoid wrapping pooled connections multiple times#1553
fix(aiomysql): avoid wrapping pooled connections multiple times#1553TimPansino merged 3 commits intonewrelic:mainfrom
Conversation
|
I'll handle moving the tests for this to the right place and making sure they're working, thanks for finding this though. Really curious how |
|
Reproduction details Agent 10.17.0 / aiomysql 0.2.0 / Python 3.12 Sample log : After this patch, the same load no longer produces RecursionErrors and the service stays healthy. |
For reference, aiomysql’s pool implementation reuses the same connection object pulled from the free queue:
|
5f6234f to
ee8b864
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1553 +/- ##
==========================================
- Coverage 81.76% 81.76% -0.01%
==========================================
Files 207 207
Lines 23946 23948 +2
Branches 3796 3797 +1
==========================================
+ Hits 19580 19581 +1
Misses 3100 3100
- Partials 1266 1267 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
* fix(aiomysql): avoid wrapping pooled connections multiple times * Move and rewrite regression test * Tweak implementation of fix --------- Co-authored-by: Tim Pansino <timpansino@gmail.com>
* Fix error when shutdown_agent called from harvest thread (#1552) * fix(aiomysql): avoid wrapping pooled connections multiple times (#1553) * fix(aiomysql): avoid wrapping pooled connections multiple times * Move and rewrite regression test * Tweak implementation of fix --------- Co-authored-by: Tim Pansino <timpansino@gmail.com> * Fix structlog tests (#1556) * Bump the github_actions group with 4 updates (#1555) Bumps the github_actions group with 4 updates: [actions/upload-artifact](https://github.com/actions/upload-artifact), [actions/download-artifact](https://github.com/actions/download-artifact), [astral-sh/setup-uv](https://github.com/astral-sh/setup-uv) and [github/codeql-action](https://github.com/github/codeql-action). Updates `actions/upload-artifact` from 4.6.2 to 5.0.0 - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](actions/upload-artifact@ea165f8...330a01c) Updates `actions/download-artifact` from 5.0.0 to 6.0.0 - [Release notes](https://github.com/actions/download-artifact/releases) - [Commits](actions/download-artifact@634f93c...018cc2c) Updates `astral-sh/setup-uv` from 7.1.1 to 7.1.2 - [Release notes](https://github.com/astral-sh/setup-uv/releases) - [Commits](astral-sh/setup-uv@2ddd2b9...8585678) Updates `github/codeql-action` from 4.30.9 to 4.31.0 - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](github/codeql-action@16140ae...4e94bd1) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-version: 5.0.0 dependency-type: direct:production update-type: version-update:semver-major dependency-group: github_actions - dependency-name: actions/download-artifact dependency-version: 6.0.0 dependency-type: direct:production update-type: version-update:semver-major dependency-group: github_actions - dependency-name: astral-sh/setup-uv dependency-version: 7.1.2 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github_actions - dependency-name: github/codeql-action dependency-version: 4.31.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github_actions ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Timothy Pansino <11214426+TimPansino@users.noreply.github.com> * Add instrumentation for new kinesis method (#1557) * Add free-threaded Python to CI (#1562) * Bump github/codeql-action in the github_actions group (#1566) Bumps the github_actions group with 1 update: [github/codeql-action](https://github.com/github/codeql-action). Updates `github/codeql-action` from 4.31.0 to 4.31.2 - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](github/codeql-action@4e94bd1...0499de3) --- updated-dependencies: - dependency-name: github/codeql-action dependency-version: 4.31.2 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github_actions ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Region aware/ Claude 3+ bedrock support (#1561) * Modify extractor logic. * Add support for Claude Sonnet 3+ and region aware models. * Update claude content extraction logic. * Add support for Claude Sonnet 3+ and region aware models. * Update claude content extraction logic. * Add testing for aiobotocore. * Restore newline. --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> * Fix notice_error logic for non-iterable exceptions. (#1564) * Revert "Fix notice_error logic for non-iterable exceptions. (#1564)" (#1568) This reverts commit b9d9d3b. * Add additional trace points for AWS Kinesis (#1569) * Enable environment variables for attribute filters (#1558) * Enable env vars for attribute filters * [MegaLinter] Apply linters fixes * Trigger tests * Change attribute filters to space delimited * Fix test assertion --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: Tim Pansino <timpansino@gmail.com> * Update version of cibuildwheel to latest (#1570) * Force uv to use non-emulated Python on windows arm64 (#1567) Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Timothy Pansino <11214426+TimPansino@users.noreply.github.com> Co-authored-by: canonrock16 <35710450+canonrock16@users.noreply.github.com> Co-authored-by: Tim Pansino <timpansino@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Uma Annamalai <uannamalai@newrelic.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: Lalleh Rafeei <84813886+lrafeei@users.noreply.github.com>
* Fix error when shutdown_agent called from harvest thread (#1552) * fix(aiomysql): avoid wrapping pooled connections multiple times (#1553) * fix(aiomysql): avoid wrapping pooled connections multiple times * Move and rewrite regression test * Tweak implementation of fix --------- Co-authored-by: Tim Pansino <timpansino@gmail.com> * Fix structlog tests (#1556) * Bump the github_actions group with 4 updates (#1555) Bumps the github_actions group with 4 updates: [actions/upload-artifact](https://github.com/actions/upload-artifact), [actions/download-artifact](https://github.com/actions/download-artifact), [astral-sh/setup-uv](https://github.com/astral-sh/setup-uv) and [github/codeql-action](https://github.com/github/codeql-action). Updates `actions/upload-artifact` from 4.6.2 to 5.0.0 - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](actions/upload-artifact@ea165f8...330a01c) Updates `actions/download-artifact` from 5.0.0 to 6.0.0 - [Release notes](https://github.com/actions/download-artifact/releases) - [Commits](actions/download-artifact@634f93c...018cc2c) Updates `astral-sh/setup-uv` from 7.1.1 to 7.1.2 - [Release notes](https://github.com/astral-sh/setup-uv/releases) - [Commits](astral-sh/setup-uv@2ddd2b9...8585678) Updates `github/codeql-action` from 4.30.9 to 4.31.0 - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](github/codeql-action@16140ae...4e94bd1) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-version: 5.0.0 dependency-type: direct:production update-type: version-update:semver-major dependency-group: github_actions - dependency-name: actions/download-artifact dependency-version: 6.0.0 dependency-type: direct:production update-type: version-update:semver-major dependency-group: github_actions - dependency-name: astral-sh/setup-uv dependency-version: 7.1.2 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github_actions - dependency-name: github/codeql-action dependency-version: 4.31.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github_actions ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Timothy Pansino <11214426+TimPansino@users.noreply.github.com> * Add instrumentation for new kinesis method (#1557) * Add free-threaded Python to CI (#1562) * Bump github/codeql-action in the github_actions group (#1566) Bumps the github_actions group with 1 update: [github/codeql-action](https://github.com/github/codeql-action). Updates `github/codeql-action` from 4.31.0 to 4.31.2 - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](github/codeql-action@4e94bd1...0499de3) --- updated-dependencies: - dependency-name: github/codeql-action dependency-version: 4.31.2 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github_actions ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Region aware/ Claude 3+ bedrock support (#1561) * Modify extractor logic. * Add support for Claude Sonnet 3+ and region aware models. * Update claude content extraction logic. * Add support for Claude Sonnet 3+ and region aware models. * Update claude content extraction logic. * Add testing for aiobotocore. * Restore newline. --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> * Fix notice_error logic for non-iterable exceptions. (#1564) * Revert "Fix notice_error logic for non-iterable exceptions. (#1564)" (#1568) This reverts commit b9d9d3b. * Add additional trace points for AWS Kinesis (#1569) * Enable environment variables for attribute filters (#1558) * Enable env vars for attribute filters * [MegaLinter] Apply linters fixes * Trigger tests * Change attribute filters to space delimited * Fix test assertion --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: Tim Pansino <timpansino@gmail.com> * Update version of cibuildwheel to latest (#1570) * Force uv to use non-emulated Python on windows arm64 (#1567) Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> * Add support 4 partial granularity tracing * Move config consolidation into global settings * [MegaLinter] Apply linters fixes * Move inifinte tracing override to server side config * [MegaLinter] Apply linters fixes * Fix failing event loop tests * Fixup: linter * [MegaLinter] Apply linters fixes --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Timothy Pansino <11214426+TimPansino@users.noreply.github.com> Co-authored-by: canonrock16 <35710450+canonrock16@users.noreply.github.com> Co-authored-by: Tim Pansino <timpansino@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Uma Annamalai <uannamalai@newrelic.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: Lalleh Rafeei <84813886+lrafeei@users.noreply.github.com> Co-authored-by: hmstepanek <30059933+hmstepanek@users.noreply.github.com>
* Fix error when shutdown_agent called from harvest thread (#1552) * fix(aiomysql): avoid wrapping pooled connections multiple times (#1553) * fix(aiomysql): avoid wrapping pooled connections multiple times * Move and rewrite regression test * Tweak implementation of fix --------- Co-authored-by: Tim Pansino <timpansino@gmail.com> * Fix structlog tests (#1556) * Bump the github_actions group with 4 updates (#1555) Bumps the github_actions group with 4 updates: [actions/upload-artifact](https://github.com/actions/upload-artifact), [actions/download-artifact](https://github.com/actions/download-artifact), [astral-sh/setup-uv](https://github.com/astral-sh/setup-uv) and [github/codeql-action](https://github.com/github/codeql-action). Updates `actions/upload-artifact` from 4.6.2 to 5.0.0 - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](actions/upload-artifact@ea165f8...330a01c) Updates `actions/download-artifact` from 5.0.0 to 6.0.0 - [Release notes](https://github.com/actions/download-artifact/releases) - [Commits](actions/download-artifact@634f93c...018cc2c) Updates `astral-sh/setup-uv` from 7.1.1 to 7.1.2 - [Release notes](https://github.com/astral-sh/setup-uv/releases) - [Commits](astral-sh/setup-uv@2ddd2b9...8585678) Updates `github/codeql-action` from 4.30.9 to 4.31.0 - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](github/codeql-action@16140ae...4e94bd1) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-version: 5.0.0 dependency-type: direct:production update-type: version-update:semver-major dependency-group: github_actions - dependency-name: actions/download-artifact dependency-version: 6.0.0 dependency-type: direct:production update-type: version-update:semver-major dependency-group: github_actions - dependency-name: astral-sh/setup-uv dependency-version: 7.1.2 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github_actions - dependency-name: github/codeql-action dependency-version: 4.31.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github_actions ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Timothy Pansino <11214426+TimPansino@users.noreply.github.com> * Add instrumentation for new kinesis method (#1557) * Add free-threaded Python to CI (#1562) * Bump github/codeql-action in the github_actions group (#1566) Bumps the github_actions group with 1 update: [github/codeql-action](https://github.com/github/codeql-action). Updates `github/codeql-action` from 4.31.0 to 4.31.2 - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](github/codeql-action@4e94bd1...0499de3) --- updated-dependencies: - dependency-name: github/codeql-action dependency-version: 4.31.2 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github_actions ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Region aware/ Claude 3+ bedrock support (#1561) * Modify extractor logic. * Add support for Claude Sonnet 3+ and region aware models. * Update claude content extraction logic. * Add support for Claude Sonnet 3+ and region aware models. * Update claude content extraction logic. * Add testing for aiobotocore. * Restore newline. --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> * Fix notice_error logic for non-iterable exceptions. (#1564) * Revert "Fix notice_error logic for non-iterable exceptions. (#1564)" (#1568) This reverts commit b9d9d3b. * Add additional trace points for AWS Kinesis (#1569) * Enable environment variables for attribute filters (#1558) * Enable env vars for attribute filters * [MegaLinter] Apply linters fixes * Trigger tests * Change attribute filters to space delimited * Fix test assertion --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: Tim Pansino <timpansino@gmail.com> * Update version of cibuildwheel to latest (#1570) * Force uv to use non-emulated Python on windows arm64 (#1567) Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> * Skip hypercorn tests for v0.18 (#1579) * Skip hypercorn tests for v0.18 * Remove tornadomaster for 3.14 * Add support for *.adaptive.sampling_target * Add adaptive sampler instances to SamplerProxy * Fix instability in CI caused by health check tests (#1584) * Bump the github_actions group across 1 directory with 5 updates (#1582) Bumps the github_actions group with 5 updates in the / directory: | Package | From | To | | --- | --- | --- | | [actions/checkout](https://github.com/actions/checkout) | `5.0.0` | `5.0.1` | | [docker/metadata-action](https://github.com/docker/metadata-action) | `5.8.0` | `5.9.0` | | [docker/setup-qemu-action](https://github.com/docker/setup-qemu-action) | `3.6.0` | `3.7.0` | | [astral-sh/setup-uv](https://github.com/astral-sh/setup-uv) | `7.1.2` | `7.1.3` | | [github/codeql-action](https://github.com/github/codeql-action) | `4.31.2` | `4.31.3` | Updates `actions/checkout` from 5.0.0 to 5.0.1 - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](actions/checkout@08c6903...93cb6ef) Updates `docker/metadata-action` from 5.8.0 to 5.9.0 - [Release notes](https://github.com/docker/metadata-action/releases) - [Commits](docker/metadata-action@c1e5197...318604b) Updates `docker/setup-qemu-action` from 3.6.0 to 3.7.0 - [Release notes](https://github.com/docker/setup-qemu-action/releases) - [Commits](docker/setup-qemu-action@2910929...c7c5346) Updates `astral-sh/setup-uv` from 7.1.2 to 7.1.3 - [Release notes](https://github.com/astral-sh/setup-uv/releases) - [Commits](astral-sh/setup-uv@8585678...5a7eac6) Updates `github/codeql-action` from 4.31.2 to 4.31.3 - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](github/codeql-action@0499de3...014f16e) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: 5.0.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github_actions - dependency-name: docker/metadata-action dependency-version: 5.9.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github_actions - dependency-name: docker/setup-qemu-action dependency-version: 3.7.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github_actions - dependency-name: astral-sh/setup-uv dependency-version: 7.1.3 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github_actions - dependency-name: github/codeql-action dependency-version: 4.31.3 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github_actions ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> * Asyncio loop_factory fix (#1576) * Runner instrumentation in asyncio * Clean up asyncio instrumentation * Add asyncio tests for loop_factory * Modify uvicorn test for loop_factory * Fix linter errors * [MegaLinter] Apply linters fixes * Apply suggestions from code review --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: Tim Pansino <timpansino@gmail.com> * Fix issue in ASGI header consumption (#1578) * Correct code for Sanic instrumentation * Correct handling of headers in ASGIWebTransaction * Correct handling of headers in ASGIBrowserMiddleware * Add regression test for ASGI headers issues --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Timothy Pansino <11214426+TimPansino@users.noreply.github.com> Co-authored-by: canonrock16 <35710450+canonrock16@users.noreply.github.com> Co-authored-by: Tim Pansino <timpansino@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Uma Annamalai <uannamalai@newrelic.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: Lalleh Rafeei <84813886+lrafeei@users.noreply.github.com>
Overview
AsyncConnectionWrapperRecursionError: maximum recursion depth exceededtests/agent_unittests/test_database_aiomysql.py) that simulates a pool returning the same connection twiceRelated Github Issue
None.
Related forum thread: https://support.newrelic.com/s/hubtopic/aAXPh000000EHIjOAO/recursionerror-when-new-relic-python-agent-instruments-aiomysql-still-happening
Testing
All tests passed including the new test I added