Skip to content

[To rel/1.1]Remove unecessary synchronized on decrementCnt of SinkListener#9690

Merged
JackieTien97 merged 1 commit intoapache:rel/1.1from
lancelly:fixMppDeadLock1.1
Apr 25, 2023
Merged

[To rel/1.1]Remove unecessary synchronized on decrementCnt of SinkListener#9690
JackieTien97 merged 1 commit intoapache:rel/1.1from
lancelly:fixMppDeadLock1.1

Conversation

@lancelly
Copy link
Contributor

cherry-picked from 6a8d009

At first, we add synchronized on decrementGet method to avoid concurrent modification on cnt or we may close the shuffleSinkHandle wrongly. However, using AtomicBoolean is enough to ensure that one channel only decrement the cnt once.
Moreover, adding synchronized on decrementGet method could lead to dead lock. Thread A invokes onFinsh of ISinkLitsener and holds the lock of it. Then A tries to lock the corresponding SinkChannel while Thread B invokes close of SinkChannel first and holds the lock of SinkChannel and then try to lock ISinkListener.
So we need to remove the synchonized keyword on decrementGet method.

@JackieTien97 JackieTien97 merged commit dedc908 into apache:rel/1.1 Apr 25, 2023
@lancelly lancelly deleted the fixMppDeadLock1.1 branch May 9, 2023 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants