scwhittle commented on code in PR #35135:
URL: https://github.com/apache/beam/pull/35135#discussion_r2124953826


##########
sdks/java/harness/src/main/java/org/apache/beam/fn/harness/control/ExecutionStateSampler.java:
##########
@@ -543,15 +543,21 @@ public void start(String processBundleId) {
 
     @Override
     public void updateIntermediateMonitoringData(Map<String, ByteString> 
monitoringData) {
-      for (ExecutionStateImpl executionState : executionStates) {
-        executionState.updateMonitoringData(monitoringData);
+      // executionState may get reset in reset() call below
+      synchronized (activeStateTrackers) {
+        for (ExecutionStateImpl executionState : executionStates) {
+          executionState.updateMonitoringData(monitoringData);

Review Comment:
   Or can we enforce this and document it better than the current incorrect 
comment about split lock around the racy variables by annotating them with:
   
   GuardedBy("ExecutionStateSampler.this.activeStateTrackers")
   It seems like that syntax might work from 
https://errorprone.info/bugpattern/GuardedBy



-- 
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