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

BatchLogRecordProcessor objects are not able to be garbage collected #4422

Open
robahlgren opened this issue Feb 7, 2025 · 0 comments
Open
Labels
bug Something isn't working

Comments

@robahlgren
Copy link

Describe your environment

OS: Debian 12 (Bookworm)
Python version: Python 3.11.2
SDK version: 1.30.0
API version: 1.30.0

What happened?

BatchLogRecordProcessor is not garbage collected, causing a memory leak

Steps to Reproduce

import gc
from opentelemetry.exporter.otlp.proto.grpc._log_exporter import OTLPLogExporter
from opentelemetry.sdk._logs.export import BatchLogRecordProcessor
for _ in range(10):
    processor = BatchLogRecordProcessor(OTLPLogExporter("test"))
    processor.shutdown()
    del processor

gc.collect()
for obj in gc.get_objects():
    if isinstance(obj, BatchLogRecordProcessor):
        print(obj)

Expected Result

No BatchLogRecordProcessor objects should remain

Actual Result

One BatchLogRecordProcessor object is found for each instantiation and consumes ~240KiB of heap as measured by memray

Additional context

No response

Would you like to implement a fix?

None

@robahlgren robahlgren added the bug Something isn't working label Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant