簡體   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