Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Proposed changes
The
pendingLogsFeed.Send(cpy)
needs to be executed asynchronously.The Send operation happens while holding a lock. If other subsystems (like those subscribing to Log events) also try to acquire the lock in theSend()
function, it could cause a deadlock, freezing the process. To fix this issue, we decided to revert the changes and return to a more reliable implementation.Code History
In the changes made in #583 ,
pendingLogsFeed.Send()
was moved out of the goroutine to reduce competition and make the code cleaner. The modified code was as follows:However, in a later code review, it was found that this code has issues when run asynchronously because the lock remains held until copying is complete. If a subsystem subscribes to Log events while also waiting for the lock in the
Send()
function, this synchronization will freeze the process. Therefore, the implementation before PR 583 need to be reverted , as shown in the following code:The reverted code has been tested and solves the stability issues caused by PR 583.
Reference PR
ethereum#16843
Types of changes
What types of changes does your code introduce to XDC network?
Put an
✅
in the boxes that applyImpacted Components
Which part of the codebase this PR will touch base on,
Put an
✅
in the boxes that applyChecklist
Put an
✅
in the boxes once you have confirmed below actions (or provide reasons on not doing so) that