-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: retry_task_map: fix mem leak when network is totally cut off (#395)
Previously, when handling failed task, the retry_task_map first releases the semaphore, and then reschedules the failed task directly without acquire the semaphore again. This results in the concurrent tasks semaphore being escaped when there are a lot of failed tasks. This is especially critical when the network is totally cut off, the failed tasks are pilling up and new tasks are still being scheduled, resulting in memory leaks. This PR fixes the above problem by fixing the task_done_cb, now when handling and re-scheduling the failed tasks, the semaphore will be kept. semaphore will only be released when the task is done successfully, or the thread-pool shutdowns. Other refinements to the retry_task_map includes: 1. watchdog: when watchdog func failed, watchdog thread will try to drain the pending workitem queue. 2. fut_gen: when thread-pool shutdowns, drain the finished futures queue. 3. dispatcher: directly exits when thread-pool shutdowns. 4. watchdog: refine the watchdog thread implementation.
- Loading branch information
1 parent
d5fd04f
commit 24b7a06
Showing
1 changed file
with
122 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24b7a06
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coverage Report