Skip to content

Commit f1abc66

Browse files
authored
Fix timeout error in the FastAPI frontend (vllm-project#34)
1 parent 5295816 commit f1abc66

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

cacheflow/frontend/fastapi_frontend.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ async def server_step(self):
8383
self.is_server_running = True
8484
updated_seq_groups = await self.server.step.remote()
8585
self.is_server_running = False
86-
# Notify the waiting coroutines that there new outputs ready.
86+
# Notify the waiting coroutines that there are new outputs ready.
8787
for seq_group in updated_seq_groups:
8888
group_id = seq_group.group_id
8989
self.running_seq_groups[group_id] = seq_group
@@ -121,7 +121,10 @@ async def generate(self, request_dict: Dict):
121121
# Wait for new output. The group_event will be set in server_step
122122
# when there is new output available for the sequence group.
123123
# Added a timeout to prevent deadlock.
124-
await asyncio.wait_for(group_event.wait(), timeout=TIMEOUT_TO_PREVENT_DEADLOCK)
124+
try:
125+
await asyncio.wait_for(group_event.wait(), timeout=TIMEOUT_TO_PREVENT_DEADLOCK)
126+
except asyncio.TimeoutError:
127+
continue
125128
# Reset the event to wait for the next output.
126129
group_event.clear()
127130
# Decode and return new outputs

0 commit comments

Comments
 (0)