2014-01-22 58 views
1

我正在運行基於我的tornado.testing.AsyncHTTPTestCase的測試用例,偶爾會在日誌中看到此堆棧跟蹤。它似乎是隨機發生的,所以多次運行測試套件有時會遇到這種情況。Tornado 3.2 OverflowError:無法將負int轉換爲無符號

這是一個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

我以前沒見過這一點,但它看起來像一個Socket對象已關閉(改變其文件描述符爲-1),而對iostream仍試圖從中讀取數據。你是否在測試中進行任何不尋常的清理,或者直接訪問任何IOStream來訪問套接字對象?

+0

沒有花哨的IOStream東西,我可以看到。如果是這樣,我預計每次運行測試套裝時都會提高OverflowError。現在就像每30次一次。 – MyGGaN

+1

嗯。你可以嘗試從github上的master分支安裝Tornado嗎?在發佈3.2版之後修復了垃圾收集的關閉套接字時出現了一些問題。我不太清楚他們是如何導致這種症狀的(因爲如果IOSteram仍在使用它們,他們不會收集垃圾),但值得一試。 –

+0

我已經簽出了關於龍捲風大師的最新消息,但仍然是同樣的問題。我會花一些時間來看看我能找到什麼測試造成這種情況。 – MyGGaN