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.
Motivation:
Try to fix #838 #842
Right now the replicator will wait on new logs when there is no more logs to be replicated by invoking
LogManager#wait(expectLogIndex, closure, threadId)
method, then log manager will create and save aWaitMeta
in memory mapwaitMap
and returns a valid waitId(starts from one) to replicator. The replicator will check whetherwaitId >= 0
to prevent waiting more than once. So in normal case, there is at most oneWaitMeta
instance for each replicator.But when user try to submit large log entries to jraft node, the bolt may checking connection fails because of netty writing buffer limitation. Checking the bolt log
~/logs/bolt/remoting-rpc.log
:Then the replicator will block a few moment and resume the replication after timeout:
After block timeout, it will reset the
waitId
and sending entries again:So the
waitId
is reset unexpectedly, and creating too manyWaitMeta
instances inLogManager
. When new log entries are appended,LogManager
will notify eachWaitMeta
closure in a thread task, it may cause closure threadpool too busy and throwsRejectedExecutionexception
.Modification:
Only reset
waitId
before sending entries and log error status at first time.Result:
Fixes #838 #842
TODO