reuvenlax commented on code in PR #41540:
URL: https://github.com/apache/beam/pull/41540#discussion_r4762789465
##########
sdks/java/harness/src/main/java/org/apache/beam/fn/harness/control/ExecutionStateSampler.java:
##########
@@ -662,21 +653,36 @@ public void updateFinalMonitoringData(Map<String,
ByteString> monitoringData) {
*/
@Override
public void reset() {
- synchronized (activeStateTrackers) {
- activeStateTrackers.remove(this);
- for (ExecutionStateImpl executionState : executionStates) {
- executionState.reset();
+ boolean deactivated = false;
+ if (this.active) {
+ synchronized (activeStateTrackers) {
+ if (this.active) {
Review Comment:
Yeah - I've bumped into this before. AI likes to assume the worst (what if a
buggy caller calls reset from another thread in the middle of processing, even
though that violates the contract). I'd already fixed similar code elsewhere,
but missed this.
##########
sdks/java/harness/src/main/java/org/apache/beam/fn/harness/control/ExecutionStateSampler.java:
##########
@@ -337,6 +321,10 @@ public class ExecutionStateTracker implements
BundleProgressReporter {
private final AtomicReference<@Nullable ExecutionStateImpl>
currentStateLazy;
// If an exception occurs, this will be to state at the time of exception.
private boolean inErrorState = false;
+ // Tracks whether start() registered this tracker with activeStateTrackers.
+ private volatile boolean active = false;
Review Comment:
done
--
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]