opentracing-python icon indicating copy to clipboard operation
opentracing-python copied to clipboard

No cap on number of active scopes or spans

Open isaaczinda opened this issue 5 years ago • 0 comments

The following code, which could have easily been written by mistake, creates an arbitrary number of spans which are never ended and take up enormous amount of memory. Python OpenTracing should have limit the number of open scopes / spans a user can have to prevent a small mistake from becoming an enormous memory leak.

from opentracing.mocktracer import MockTracer

tracer = MockTracer()

while True:
    with tracer.start_span(operation_name='make_some_request') as client_span:
        tracer.scope_manager.activate(client_span, True)
        pass

isaaczinda avatar Aug 29 '19 20:08 isaaczinda