[ https://issues.apache.org/jira/browse/BEAM-12209?focusedWorklogId=587663&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-587663 ]
ASF GitHub Bot logged work on BEAM-12209: ----------------------------------------- Author: ASF GitHub Bot Created on: 23/Apr/21 07:06 Start Date: 23/Apr/21 07:06 Worklog Time Spent: 10m Work Description: scwhittle commented on a change in pull request #14617: URL: https://github.com/apache/beam/pull/14617#discussion_r618987522 ########## File path: sdks/java/fn-execution/src/main/java/org/apache/beam/sdk/fn/stream/DirectStreamObserver.java ########## @@ -59,9 +60,8 @@ public DirectStreamObserver(Phaser phaser, CallStreamObserver<T> outboundObserve @Override public void onNext(T value) { - numberOfMessagesBeforeReadyCheck += 1; - if (numberOfMessagesBeforeReadyCheck >= maxMessagesBeforeCheck) { - numberOfMessagesBeforeReadyCheck = 0; + if (maxMessagesBeforeCheck <= 1 || Review comment: No since it is final -- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 587663) Time Spent: 1h 10m (was: 1h) > DirectStreamObserver is not thread-safe as advertised due to racy integer > operations > ------------------------------------------------------------------------------------ > > Key: BEAM-12209 > URL: https://issues.apache.org/jira/browse/BEAM-12209 > Project: Beam > Issue Type: Bug > Components: java-fn-execution > Reporter: Sam Whittle > Assignee: Sam Whittle > Priority: P2 > Time Spent: 1h 10m > Remaining Estimate: 0h > > An AtomicInteger should be used instead for the message counting for periodic > flow control checking. -- This message was sent by Atlassian Jira (v8.3.4#803005)