我正在运行官方节俭py:tornado demo,在客户关闭运输后引发异常。
示例:https://github.com/apache/thrift/tree/master/tutorial/py.tornado
Starting the server...
ping()
add(1, 1)
zip()
zip()
calculate(1, Work(comment=None, num1=1, num2=0, op=4))
calculate(1, Work(comment=None, num1=15, num2=10, op=2))
getStruct(1)
ERROR:thrift.TTornado:thrift exception in handle_stream
Traceback (most recent call last):
File "/Users/user/venv/py27/lib/python2.7/site-packages/thrift/TTornado.py", line 174, in handle_stream
frame = yield trans.readFrame()
File "/Users/user/venv/py27/lib/python2.7/site-packages/tornado/gen.py", line 1008, in run
value = future.result()
File "/Users/user/venv/py27/lib/python2.7/site-packages/tornado/concurrent.py", line 232, in result
raise_exc_info(self._exc_info)
File "/Users/user/venv/py27/lib/python2.7/site-packages/tornado/gen.py", line 1014, in run
yielded = self.gen.throw(*exc_info)
File "/Users/user/venv/py27/lib/python2.7/site-packages/thrift/TTornado.py", line 141, in readFrame
raise gen.Return(frame)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__
self.gen.throw(type, value, traceback)
File "/Users/user/venv/py27/lib/python2.7/site-packages/thrift/TTornado.py", line 125, in io_exception_context
message=str(e))
TTransportException: Stream is closed
有没有办法避免这个错误消息或如何捕获它?
答案 0 :(得分:0)
很多原因会导致StreamClosedError
。
THttpServer
无法提供Tornado客户端流。StreamClosedError
消失了。 客户端Thrift版本:0.10.0
龙卷风版:4.5
客户端Python版本:3.5.2
系统版本:Ubuntu 16.04