Skip to content

Commit 7dc06ca

Browse files
authored
[BugFix] race condition [is_fetching] causing multiple fetch requests (PaddlePaddle#5238)
* RouterArgs port str -> int * fix race condition [is_fetching] causing multiple fetch requests * bugfix: Delete duplicate input_ids tensor creation
1 parent 35479b6 commit 7dc06ca

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

fastdeploy/engine/common_engine.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,6 @@ def _schedule_request_to_worker_v1(self):
680680
def _fetch_request():
681681
try:
682682
nonlocal is_fetching
683-
is_fetching = True
684683
num_prefill_batch = min(
685684
int(self.resource_manager.available_batch()),
686685
self.cfg.max_prefill_batch,
@@ -803,6 +802,7 @@ def _fetch_request():
803802
continue
804803
if self.cfg.scheduler_config.splitwise_role != "mixed":
805804
if not is_fetching:
805+
is_fetching = True
806806
get_request_pool.submit(_fetch_request)
807807

808808
else:
@@ -813,6 +813,7 @@ def _fetch_request():
813813
):
814814
# Check if the thread pool is still available to avoid submitting tasks to a shutdown thread pool.
815815
try:
816+
is_fetching = True
816817
get_request_pool.submit(_fetch_request)
817818
except RuntimeError as e:
818819
if "shutdown" in str(e):

fastdeploy/engine/sched/resource_manager_v1.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,6 @@ def _get_num_new_tokens(self, request, token_budget):
414414
):
415415
input_ids_lst = request.prompt_token_ids + request.output_token_ids
416416
input_ids = paddle.to_tensor(input_ids_lst, dtype="int64")
417-
input_ids = paddle.to_tensor(input_ids_lst, dtype="int64")
418417
image_patch_id = inputs["image_patch_id"]
419418

420419
if request.multimodal_img_boundaries is None:

fastdeploy/router/router.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class RouterArgs:
3232
"""
3333
Host address to bind the router server
3434
"""
35-
port: str = "9000"
35+
port: int = 9000
3636
"""
3737
Port to bind the router server.
3838
"""
@@ -55,7 +55,7 @@ def add_cli_args(parser: FlexibleArgumentParser) -> FlexibleArgumentParser:
5555
)
5656
parser.add_argument(
5757
"--port",
58-
type=str,
58+
type=int,
5959
default=RouterArgs.port,
6060
help="Port number to bind the router server",
6161
)

0 commit comments

Comments
 (0)