简体   繁体   English

TTransportException,无任何特定消息

[英]TTransportException without any specific message

I got this exception and it doesn't have any specific message such as "read timeout, "connection refuse" or "connection reset". And this exception doesn't happen usually. 我遇到了这个异常,它没有任何特定的消息,例如“读取超时,“连接拒绝”或“连接重置”。通常不会发生此异常。

I wonder What is the root cause of this exception? 我想知道此异常的根本原因是什么?

org.apache.thrift.transport.TTransportException at org.apache.thrift.transport.TIOStreamTransport.read(TIOStreamTransport.java:132) at org.apache.thrift.transport.TTransport.readAll(TTransport.java:84) at org.apache.thrift.transport.TFramedTransport.readFrame(TFramedTransport.java:129) at org.apache.thrift.transport.TFramedTransport.read(TFramedTransport.java:101) at org.apache.thrift.transport.TTransport.readAll(TTransport.java:84) at org.apache.thrift.protocol.TBinaryProtocol.readAll(TBinaryProtocol.java:378) at org.apache.thrift.protocol.TBinaryProtocol.readI32(TBinaryProtocol.java:297) at org.apache.thrift.protocol.TBinaryProtocol.readMessageBegin(TBinaryProtocol.java:204) at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:69) org.org.apache.thrift.transport.TIOStreamTransport.read(TIOStreamTransport.java:132)org.apache.thrift.transport.TTransport.readAll(TTransport.java:84)处的org.apache.thrift.transport.TTransportException org.apache.thrift.transport.TFramedTransport.read(TFramedTransport.java:101)上的apache.thrift.transport.TFramedTransport.readFrame(TFramedTransport.java:129)org.apache.thrift.transport.TTransport.readAll(TTransport。 org.apache.thrift.protocol.TBinaryProtocol.readAll(TBinaryProtocol.java:378)的org.apache.thrift.protocol.TBinaryProtocol.readI32(TBinaryProtocol.java:297)的org.apache.thrift.protocol .TBinaryProtocol.readMessageBegin(TBinaryProtocol.java:204)位于org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:69)

The relevant line in the code says 代码中相关行

 if (bytesRead < 0) { 
    throw new TTransportException(TTransportException.END_OF_FILE); 
 } 

The caller was not able to read len bytes from the underlying transport, which usually means that the remote end hung up (closed the connection): 调用者无法从基础传输中读取len个字节,这通常意味着远程端挂断(关闭了连接):

/** 
 * Reads from the underlying input stream if not null. 
 */ 
public int read(byte[] buf, int off, int len) throws TTransportException 
{ 
    if (inputStream_ == null) { 
        throw new TTransportException(TTransportException.NOT_OPEN, "Cannot read from null inputStream"); 
    } 
    int bytesRead; 
    try { 
        bytesRead = inputStream_.read(buf, off, len); 
    } catch (IOException iox) { 
        throw new TTransportException(TTransportException.UNKNOWN, iox); 
    } 
   if (bytesRead < 0) { 
       throw new TTransportException(TTransportException.END_OF_FILE); 
    } 
    return bytesRead; 
} 

For servers, and you don't experience any problems that indicate an issue, that particular one is just how Thrift works. 对于服务器,您不会遇到任何表明问题的问题,该特定问题只是Thrift的工作方式。

For clients, as in your example, it seems to indicate that the server closed the connection prematurely (the client waits in TServiceClient.receiveBase() to receive a response). 对于客户端,如您的示例所示,它似乎表明服务器过早关闭了连接(客户端在TServiceClient.receiveBase()等待接收响应)。

Most likely reason is some uncaught error on the server end. 最可能的原因是服务器端出现一些未捕获的错误。 Another possible source that comes to mind is could be mismatch of protocol/transport stacks. 我想到的另一个可能的来源可能是协议/传输堆栈不匹配。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM