Tornado 3.2 OverflowError:无法将负int转换为unsigned

时间:2014-01-22 15:06:21

标签: python-3.x tornado

我正在运行基于tornado.testing.AsyncHTTPTestCase的测试用例,偶尔会在日志中看到这个堆栈跟踪。它似乎是随机发生的,因此多次运行测试套件有时会遇到这种情况。

这是一个tornado 3.2错误还是我应该如何处理这个例外?

它似乎不会影响我的任何测试结果,但我对这样的随机异常感到不满意。

ERROR:tornado.application:Exception in callback functools.partial(<function wrap.<locals>.wrapped at 0x10727d830>)
Traceback (most recent call last):
  File "/Users/fredrik/.virtualenvs/project/lib/python3.3/site-packages/tornado/ioloop.py", line 477, in _run_callback
    callback()
  File "/Users/fredrik/.virtualenvs/project/lib/python3.3/site-packages/tornado/stack_context.py", line 331, in wrapped
    raise_exc_info(exc)
  File "<string>", line 3, in raise_exc_info
  File "/Users/fredrik/.virtualenvs/project/lib/python3.3/site-packages/tornado/stack_context.py", line 302, in wrapped
    ret = fn(*args, **kwargs)
  File "/Users/fredrik/.virtualenvs/project/lib/python3.3/site-packages/tornado/iostream.py", line 366, in wrapper
    self._maybe_add_error_listener()
  File "/Users/fredrik/.virtualenvs/project/lib/python3.3/site-packages/tornado/iostream.py", line 600, in _maybe_add_error_listener
    self._add_io_state(ioloop.IOLoop.READ)
  File "/Users/fredrik/.virtualenvs/project/lib/python3.3/site-packages/tornado/iostream.py", line 630, in _add_io_state
    self.fileno(), self._handle_events, self._state)
  File "/Users/fredrik/.virtualenvs/project/lib/python3.3/site-packages/tornado/ioloop.py", line 545, in add_handler
    self._impl.register(fd, events | self.ERROR)
  File "/Users/fredrik/.virtualenvs/project/lib/python3.3/site-packages/tornado/platform/kqueue.py", line 41, in register
    self._control(fd, events, select.KQ_EV_ADD)
  File "/Users/fredrik/.virtualenvs/project/lib/python3.3/site-packages/tornado/platform/kqueue.py", line 60, in _control
    fd, filter=select.KQ_FILTER_READ, flags=flags))
OverflowError: can't convert negative int to unsigned

1 个答案:

答案 0 :(得分:1)

我之前没有见过这个,但看起来套接字对象已被关闭(将其文件描述符更改为-1),而IOStream仍在尝试从中读取它。您是否在测试中进行任何异常清理或直接进入任何IOStream以访问套接字对象?