Details
-
Bug
-
Status: Closed
-
Blocker
-
Resolution: Fixed
-
1.14.0
Description
The problem is the buffer listener will be removed from the listener queue when notified and then it will be added to the listener queue again if it needs more buffers. However, if some buffers are recycled meanwhile, the buffer listener will not be notified of the available buffers. For example:
1. Thread 1 calls LocalBufferPool#recycle().
2. Thread 1 reaches LocalBufferPool#fireBufferAvailableNotification() and listener.notifyBufferAvailable() is invoked, but Thread 1 sleeps before acquiring the lock to registeredListeners.add(listener).
3. Thread 2 is being woken up as a result of notifyBufferAvailable() call. It takes the buffer, but it needs more buffers.
4. Other threads, return all buffers, including this one that has been recycled. None are taken. Are all in the LocalBufferPool.
5. Thread 1 wakes up, and continues fireBufferAvailableNotification() invocation.
6. Thread 1 re-adds listener that's waiting for more buffer registeredListeners.add(listener).
7. Thread 1 exits loop LocalBufferPool#recycle(MemorySegment, int) inside, as the original memory segment has been used.
At the end we have a state where all buffers are in the LocalBufferPool, so no new recycle() calls will happen, but there is still one listener waiting for a buffer (despite buffers being available).
Attachments
Issue Links
- is caused by
-
FLINK-16641 Announce sender's backlog to solve the deadlock issue without exclusive buffers
- Closed
- is related to
-
FLINK-24035 Fix the deadlock issue caused by buffer listeners may not be notified
- Closed
- split to
-
FLINK-24919 UnalignedCheckpointITCase hangs on Azure
- Closed
- links to