【问题标题】:Strange threading error while python garbage collection after script is done脚本完成后python垃圾收集时出现奇怪的线程错误
【发布时间】:2015-04-22 14:24:36
【问题描述】:

我有一个 python 脚本,它同时使用多个 SSH 链接到多个远程服务器。有时当脚本完成时,我想在垃圾收集期间,我得到了这个异常:

Exception in thread Thread-7 (most likely raised during interpreter shutdown):
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner
  File "/usr/lib/python2.7/dist-packages/paramiko/transport.py", line 1574, in run
<type 'exceptions.AttributeError'>: 'NoneType' object has no attribute 'error'
Exception in thread Thread-5 (most likely raised during interpreter shutdown):
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner
  File "/usr/lib/python2.7/dist-packages/paramiko/transport.py", line 1574, in run
<type 'exceptions.AttributeError'>: 'NoneType' object has no attribute 'error'
Exception in thread Thread-4 (most likely raised during interpreter shutdown):
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner
  File "/usr/lib/python2.7/dist-packages/paramiko/transport.py", line 1574, in run
<type 'exceptions.AttributeError'>: 'NoneType' object has no attribute 'error'
Exception in thread Thread-1 (most likely raised during interpreter shutdown):
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner
  File "/usr/lib/python2.7/dist-packages/paramiko/transport.py", line 1574, in run
<type 'exceptions.AttributeError'>: 'NoneType' object has no attribute 'error'

我搜索了Exception in thread Thread-7 (most likely raised during interpreter shutdown),发现有时在多线程脚本中杀死线程会导致此异常。这对我来说真的很奇怪,因为我的脚本中没有线程。另一方面,它似乎与paramiko 有关,我很确定我不使用线程来创建 SSH 链接;我只有多个打开的 shell 连接到多台服务器(可能不止一个 shell 连接到一台特定的服务器)。知道异常的来源吗??

【问题讨论】:

标签: python exception paramiko python-multithreading


【解决方案1】:

这似乎是 Paramiko 中的一个已知错误,请参阅:https://github.com/paramiko/paramiko/issues/17

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-01-31
    • 1970-01-01
    • 1970-01-01
    • 2011-01-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多