AHeise commented on a change in pull request #10009: [FLINK-14304] Avoid task
starvation with mailbox
URL: https://github.com/apache/flink/pull/10009#discussion_r342589789
##########
File path:
flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/mailbox/TaskMailboxImpl.java
##########
@@ -77,22 +112,30 @@ public boolean hasMail() {
@Override
public Optional<Mail> tryTake(int priority) throws
IllegalStateException {
+ Optional<Mail> head = tryTakeFromBatch();
Review comment:
`takeFromBatch` doesn't make any sense. If the batch is empty, this will
block indefinitively as batches can only be created from the main thread.
Calling `createBatch` every time you call `tryTake` or `take` would not
solve task starvation at all. In fact, we can get rid of the batches again (if
not for performance reasons).
The main idea is that only `#runMailboxLoop` will create a batch, such that
that loop is scoped. Any non-batched variant first reads from the batch and
then falls back to old behavior.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services