[RL] re-abort_request when model_update_lock is still locked (#13338)

This commit is contained in:
Zilin Zhu
2025-11-17 12:13:39 +08:00
committed by GitHub
parent d368c7451a
commit 147b782352
2 changed files with 12 additions and 1 deletions

View File

@@ -1190,7 +1190,14 @@ class TokenizerManager(TokenizerCommunicatorMixin):
async def pause_generation(self):
async with self.is_pause_cond:
self.is_pause = True
self.abort_request(abort_all=True)
# we are using the model_update_lock to check if there is still on-going requests.
while True:
# TODO: maybe make it async instead of fire-and-forget
self.abort_request(abort_all=True)
is_locked = await self.model_update_lock.is_locked()
if not is_locked:
break
await asyncio.sleep(1.0)
async def continue_generation(self):
async with self.is_pause_cond:

View File

@@ -75,6 +75,10 @@ class RWLock:
# Wake up anyone waiting (readers or writers)
self._cond.notify_all()
async def is_locked(self):
async with self._lock:
return self._writer_active or self._readers > 0
class _ReaderLock:
def __init__(self, rwlock: RWLock):