Skip to content

Batch exporter drops last batch on shutdown #37

@Nancy-Chauhan

Description

@Nancy-Chauhan

Bug Report\n\nWhen the Python interpreter shuts down, the batch processor's atexit handler races with the daemon flush thread. The last batch of spans in the buffer is sometimes dropped because the thread is killed before it can flush.\n\n## Steps to reproduce\n\npython\nprocessor = BatchProcessor(export_fn=send, batch_size=100)\nfor span in generate_spans(150): # 100 flush, 50 remain\n processor.add(span)\n# Exit without explicit shutdown — last 50 spans lost\n\n\n## Expected\nAll 150 spans exported.\n\n## Actual\nOnly 100 spans exported. The remaining 50 are lost.\n\n## Root cause\nThe daemon thread is killed before the atexit handler runs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcriticalCritical priority

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions