Skip to content

Fix batch processor flush and shutdown races - #9037

Open
Ferdinand-MZ wants to merge 2 commits into
open-telemetry:mainfrom
Ferdinand-MZ:fix/batch-processor-flush-shutdown
Open

Ferdinand-MZ wants to merge 2 commits into
open-telemetry:mainfrom
Ferdinand-MZ:fix/batch-processor-flush-shutdown

Conversation

@Ferdinand-MZ

Copy link
Copy Markdown

Fixes #9035

Summary

  • Prevent telemetry loss when shutdown overlaps an in-flight forceFlush.
  • Handle forceFlush requests after worker termination.
  • Add regression tests for trace and logs batch processors.

Verification

  • ./gradlew :sdk:trace:check :sdk:logs:check --rerun-tasks
  • BUILD SUCCESSFUL (156 tasks executed).

@linux-foundation-easycla

linux-foundation-easycla Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: Ferdinand-MZ / name: Ferdinand-MZ (7885fbb)

@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Pull request dashboard status

Waiting on the author · refreshed 2026-11-14 14:51 UTC

Investigate required status check failures.

Status above doesn't look right?
  • Just replied or pushed? Anything around or after the refresh time above may not be picked up yet — give it a few minutes.
  • Should this be with reviewers? Comment /dashboard route:reviewers to route it to them.
  • Anything wrong — including the routing? Report it with what you expected; it helps us improve the dashboard.

@codecov

codecov Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 86.66667% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.46%. Comparing base (4ce8c01) to head (dfcfeb8).

Files with missing lines Patch % Lines
...metry/sdk/logs/export/BatchLogRecordProcessor.java 85.48% 1 Missing and 8 partials ⚠️
...telemetry/sdk/trace/export/BatchSpanProcessor.java 87.93% 1 Missing and 6 partials ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##               main    #9037   +/-   ##
=========================================
  Coverage     90.45%   90.46%           
- Complexity    11179    11181    +2     
=========================================
  Files          1032     1032           
  Lines         30500    30550   +50     
  Branches       3991     4009   +18     
=========================================
+ Hits          27590    27636   +46     
+ Misses         1935     1933    -2     
- Partials        975      981    +6     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

- Refine worker loop to immediately exit upon thread interruption and complete pending flushes with failure.
- Ensure pending flush requests are failed if an unexpected exception occurs during queue drainage in flush().
- Add comprehensive regression tests for concurrent forceFlush, trailing flushes during shutdown, exporter failures, worker interruption, and queue drainage exceptions.
- Ensure full deterministic synchronization across all new test cases.
@Ferdinand-MZ
Ferdinand-MZ marked this pull request as ready for review November 14, 2026 14:51
@Ferdinand-MZ
Ferdinand-MZ requested a review from a team as a code owner November 14, 2026 14:51

This branch has not been deployed

No deployments
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.

Batch processors may lose telemetry when shutdown overlaps with forceFlush

1 participant