arunpandianp commented on code in PR #33580:
URL: https://github.com/apache/beam/pull/33580#discussion_r1925183844
##########
runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/streaming/ActiveWorkState.java:
##########
@@ -219,14 +220,12 @@ synchronized ImmutableList<RefreshableWork>
getRefreshableWork(Instant refreshDe
.collect(toImmutableList());
}
- private void incrementActiveWorkBudget(Work work) {
- activeGetWorkBudget.updateAndGet(
- getWorkBudget -> getWorkBudget.apply(1,
work.getSerializedWorkItemSize()));
+ private synchronized void incrementActiveWorkBudget(Work work) {
+ activeGetWorkBudget = activeGetWorkBudget.apply(1,
work.getSerializedWorkItemSize());
}
- private void decrementActiveWorkBudget(Work work) {
- activeGetWorkBudget.updateAndGet(
- getWorkBudget -> getWorkBudget.subtract(1,
work.getSerializedWorkItemSize()));
+ private synchronized void decrementActiveWorkBudget(Work work) {
Review Comment:
I suspected deadlock, but it was the n^2 loop inside failWorkForKey()
holding the lock for too long that caused the delay.
This PR is not locking more mutexes than before, all calls to
`decrementActiveWorkBudget`, `incrementActiveWorkBudget`,
`currentActiveWorkBudget ` are done holding the ActiveWorkStae.this mutex.
Should be good to merge this change.
--
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]