parveensania opened a new pull request, #41825:
URL: https://github.com/apache/beam/pull/41825

   Fixes two race conditions during Windmill stream shutdown/send failures in 
the Dataflow Streaming Engine worker, plus a work-completion bug that could 
reschedule already-running work.
   ### Summary of Changes
   1. **Clean up failed get-data batches before waiters retry 
(`GrpcGetDataStream`)**
      - Requests were recorded as pending before sending the batch. If sending 
threw an error, waiting callers retried with the same request IDs while stale 
entries remained tracked on the stream, failing with `VerifyException: Request 
already sent`.
      - Failed sends now remove the batch's entries from the pending map so 
retries succeed cleanly (while keeping entries intact when the stream is 
already closing and will cancel them on teardown).
   2. **Prevent duplicate commit callbacks during shutdown 
(`GrpcCommitWorkStream`)**
      - Two races could complete the same commit twice during stream shutdown:
        - A send racing with shutdown could leave commits in the pending map 
after the flush already aborted them, causing shutdown to abort them a second 
time.
        - Shutdown iterated over pending commits and invoked abort callbacks 
before removing entries, racing with incoming responses that remove and 
complete the same commits.
      - Commits are now removed from the pending map when a send fails due to 
shutdown, and shutdown/timeout cleanup atomically removes each pending commit 
before invoking its callback.
   3. **Do not reschedule active work on a stale completion 
(`ActiveWorkState`)**
      - When a completion arrived with a mismatched work token, the active head 
item was left running, yet the method still returned it as the next work item 
to execute—scheduling duplicate concurrent execution for the same key.
      - Completion now returns empty unless it actually removed the active head 
item (and defensively removes an empty queue if encountered).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to