繁体   English   中英

似乎没有捕获到引发的异常

[英]Raised exception seemingly not caught

我使用futures.ProcessPoolExecutor(max_workers=4)运行一个应用程序。 在linux上,它运行良好。 在两个不同的macOS上,它会冻结/锁定/我们不知道。 当我们在macos上按CTRL + C时,将显示以下堆栈跟踪。

Traceback (most recent call last):
Traceback (most recent call last):
Traceback (most recent call last):
Traceback (most recent call last):
  File "tests/parallel/recorder_tool.py", line 168, in __enter__
  File "tests/parallel/recorder_tool.py", line 168, in __enter__
  File "tests/parallel/recorder_tool.py", line 168, in __enter__
  File "tests/parallel/recorder_tool.py", line 168, in __enter__
    self.manager = self.__class__.managers.pop()
    self.manager = self.__class__.managers.pop()
    self.manager = self.__class__.managers.pop()
IndexError: pop from empty list
IndexError: pop from empty list

During handling of the above exception, another exception occurred:

    self.manager = self.__class__.managers.pop()
IndexError: pop from empty list

During handling of the above exception, another exception occurred:

KeyboardInterrupt

During handling of the above exception, another exception occurred:

KeyboardInterrupt
IndexError: pop from empty list
KeyboardInterrupt
Exception ignored in: 'grpc._cython.cygrpc._next'
...

这是与IndexError相关的代码示例。

try:                                            
    self.manager = self.__class__.managers.pop()
except IndexError:                              
    self.manager = Factory.get_manager(get_conn)

except IndexError块外,但堆栈跟踪使它看起来好像从未达到过。 我是否应该在这里进行一些研究,或者仅仅是因为按下了Ctrl + C就没有更多的异常处理程序了? 另外,是否有任何明显的原因可以在Linux而不是macos上运行?

谢谢!

您的IndexError被捕获。 解开交错的堆栈轨迹后,似乎在处理IndexError时KeyboardInterrupt到达了(在每个进程中)。 下一行:

During handling of the above exception, another exception occurred:

表示隐式异常链接 在处理现有异常时发生了新异常,因此将两个异常附加在一起,并打印了两个堆栈跟踪。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM