RATIS-1603. TimeoutScheduler can have a huge amount of threads and cause OOM.#666
RATIS-1603. TimeoutScheduler can have a huge amount of threads and cause OOM.#666szetszwo merged 3 commits intoapache:masterfrom
Conversation
|
@codings-dan , could you review this? It seems the new TimeoutTimer is safer than the existing TimeoutScheduler. |
|
@szetszwo Of course. I am testing if this patch can solve the problem, and will review the code after testing. |
codings-dan
left a comment
There was a problem hiding this comment.
@szetszwo Thanks for working on this. I tested and found that OOM has been resolved. Overall LGTM, just left two comments for reference.
| } | ||
|
|
||
| /** @return the number of scheduled but not completed timeout tasks. */ | ||
| int getQueueSize(); |
There was a problem hiding this comment.
should we rename it to getTaskCount or a more explicit method name?
| import java.util.function.Supplier; | ||
|
|
||
| public final class TimeoutScheduler implements Closeable { | ||
| public final class TimeoutScheduler implements TimeoutExecutor { |
There was a problem hiding this comment.
Should we remove this class, it will cause thread overflow and should not be called again
There was a problem hiding this comment.
Let's keep it for a while. Not sure if we may find some problem in the new TimeoutTimer in the future. It may be useful then.
codings-dan
left a comment
There was a problem hiding this comment.
The change looks good, +1
See https://issues.apache.org/jira/browse/RATIS-1603