Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

某个worker死掉后,mp.Queue() get获取输入数据,锁无法释放bug #94

Open
lxsyz opened this issue Sep 5, 2022 · 0 comments

Comments

@lxsyz
Copy link

lxsyz commented Sep 5, 2022

你好,我启动2个worker测试服务效果,在我手动杀死第一个worker时(模拟服务意外崩了的情况),发现有时候第一个worker会占据读取输入队列数据的_rlock,手动杀死时,这个锁不会被释放,从而导致第二个worker总是不能从队列中get到值,recv_request永远超时,队列长度持续增大。请问有没有什么好的异常处理方案?

我使用的是Streamer和StreamerWorker

try:
    print("_recv_request pid is: " + str(os.getpid()))
    print("_request_queue is: " + str(self._request_queue.qsize()))
    item = self._request_queue.get(timeout=timeout)

except Empty:

    raise TimeoutError
else:
    return item
# queues.py中的代码
if not self._rlock.acquire(block, timeout):
    print("锁住了")
    raise Empty
@lxsyz lxsyz changed the title mp.Queue() get输入数据,锁bug 某个worker死掉后,mp.Queue() get获取输入数据,锁无法释放bug Sep 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant