Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove references to disposed SQLAlchemy engines from instrumentation singleton #3053

Merged
merged 5 commits into from
Dec 3, 2024

Conversation

rbagd
Copy link
Contributor

@rbagd rbagd commented Nov 27, 2024

EngineTracer singleton class in SQLAlchemy instrumentations keeps weak references to a traced SQLAlchemy engine forever which can cause a noticeable memory leak if engines are constantly being created.

Description

Previously raised issue #1761 regarding a memory leak in SQLAlchemy instrumentation was partially fixed by yours truly in PR#1771, but the fix appears to have been incomplete. This PR should completely fix #1761.

Fixes #1761

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

  • Additional unit test to ensure objects are cleaned up

Does This PR Require a Core Repo Change?

  • No.

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

EngineTracer in SQLAlchemy keeps weak references to a traced engine forever which
can cause a noticeable memory leak if engines are constantly getting creating.
@rbagd rbagd requested a review from a team as a code owner November 27, 2024 23:15
@xrmx xrmx enabled auto-merge (squash) December 3, 2024 09:23
@xrmx xrmx merged commit b6541f0 into open-telemetry:main Dec 3, 2024
573 checks passed
@rbagd rbagd deleted the fix-enginetracer-memoryleak branch December 3, 2024 12:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sqlalchemy memory leak with Engine cleanup introduced in 0.37b0
5 participants