Skip to content

[BUG] EventHubBufferedProducerClient: maxWaitTime is restarted by every event, so partial batches are delayed until full #50921

Open

Description

@liadl-securitas

Describe the bug
EventDataAggregator builds its timer as Flux.switchOnNext(eventSink.map(e -> Flux.interval(maxWaitTime))), so
every enqueued event restarts the timer. It behaves like an idle/debounce timer: as long as events for a partition
arrive more often than maxWaitTime, the timer never fires and a batch is only published once it is full by size.

The Javadoc of EventHubBufferedProducerClientBuilder.maxWaitTime(Duration) says:

The amount of time to wait for a batch to be built with events in the buffer before publishing a partially full batch.

Observed

  • maxWaitTime = 250 ms, 6 partitions, ~1 KB events.
  • ~100 events/s total → end-to-end latency ~1 s.
  • ~250 events/s total (~42 events/s per partition) → latency ~30 s, i.e. the time to fill a 1 MB batch
    (~1,240 events) — higher load gives dramatically higher latency.

Expected behavior
A partially full batch is published at most maxWaitTime after its first event was added, regardless of how fast
further events arrive.

To Reproduce
Enqueue events to one partition at an interval shorter than maxWaitTime (e.g. every 50 ms with maxWaitTime 250 ms)
and observe that nothing is sent until the batch is full. Regression test pushesBatchAfterMaxTimeWhileEventsKeepArriving
in the linked PR.

Setup

  • Java 17, azure-messaging-eventhubs 5.21.6 (same code on main as of 2026-10-21)

Activity

  1. github-actions commented on Oct 22, 2026

    @github-actions
    Contributor

    🎯 Agentic Issue Triage

    Summary: EventDataAggregator restarts its maxWaitTime timer on every enqueued event (switchOnNext), so partial batches are delayed until full when events arrive faster than maxWaitTime.

    📋 Issue Details

    Package: com.azure:azure-messaging-eventhubs 5.21.6
    Affected API: EventDataAggregator, EventHubBufferedProducerClientBuilder.maxWaitTime(Duration)
    Scenarios:

    • 250 ms maxWaitTime, 6 partitions: ~100 events/s gives ~1 s latency; ~250 events/s gives ~30 s latency

    Root ask: Publish a partial batch at most maxWaitTime after its first event, per the Javadoc.

    🔎 Debugging / Reproduction Notes

    The described timer behaves as a debounce/idle timer rather than a fixed deadline from the first event.

    Suggested investigation steps:

    1. Review the timer construction in EventDataAggregator.
    2. Start the timer on the first event of a batch and reset it only after publish.
    3. Run the author's linked regression test pushesBatchAfterMaxTimeWhileEventsKeepArriving.
    🏷️ Label Confidence
    • Category: Client — data-plane SDK behavior
    • Service: Event Hubs — buffered producer client in azure-messaging-eventhubs
    • Confidence: High — package and component are named explicitly. The deprecation check was not performed against the CSV; azure-messaging-eventhubs is an actively maintained package.
    👥 Owner Routing
    • Matched CODEOWNERS entry: # ServiceLabel: %Event Hubs (line 335) — service label matches
    • AzureSdkOwners: none listed
    • ServiceOwners: axisc, hmlam, j7nw4r, SwayGom, sagar0207, sjkwak
    • Routing action: Requested Service Attention and needs-team-attention; left unassigned
    • Scan notes: The %Mgmt catch-all did not match because the category is Client.

    Generated by Agentic Triage for #50921 · auto · 13.8 AIC · ⊞ 16.3K · ◷

  2. added
    questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that
    Service AttentionWorkflow: This issue is responsible by Azure service team.
    ClientThis issue points to a problem in the data-plane of the library.
    customer-reportedIssues that are reported by GitHub users external to the Azure organization.
    needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK team
    on Oct 22, 2026
  3. github-actions commented on Oct 22, 2026

    @github-actions
    Contributor

    Thank you for your feedback. Tagging and routing to the team member(s) best able to assist.

    //cc: Ashish Chhabria (@axisc) Eric Lam (MSFT) (@hmlam) Johnathan W (@j7nw4r) Josue Gomez (@SwayGom) Sagar Patel (@sagar0207) SJ (@sjkwak)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ClientThis issue points to a problem in the data-plane of the library.Event HubsService AttentionWorkflow: This issue is responsible by Azure service team.customer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK teamquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions