python - thrift timeout for long run call: thrift.transport.TTransport.TTransportException: TSocket read 0 bytes -
i've build rpc service using thrift. may run long time (minutes hours) each call. i've set thrift timeout 2 days.
transport = tsocket.tsocket(self.__host, self.__port) transport.settimeout(2 * 24 * 60 * 60 * 1000)
but thrift closes connection after 600s, following exception:
thrift.transport.ttransport.ttransportexception: tsocket read 0 bytes
is there's other timeout should set? (python, thrift server: windows; client: ubuntu)
the thrift transport connection being disconnected. due network issues or remote service restart or time out issues. whenever call made after disconnect results in ttransportexception. problem can solved reconnecting remote service. try using this, invoking before making remote service call.
def repoen_transport(): try: if not transport.isopen(): transport.open() except exception, msg: print >> sys.stderr.write("error reopening transport {}".format(msg))
Comments
Post a Comment