1. Thrift
  2. THRIFT-517

TExceptions thrown by server result in cryptic error message on client - Tried to read 4 bytes, but only got 0 bytes


    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.6
    • Labels:


      To reproduce:

      1. Define a simple Thrift service method with no custom exceptions.
      2. In server implementation of service method, throw a TException.
      3. Generated code in client forces you to do try/catch TException around service call, do this, and output stack trace,

      The exception thrown by the server then results in this rather cryptic error message in the client:

      26 22:32:44,931 INFO Caused by: org.apache.thrift.transport.TTransportException: Cannot read. Remote side has closed. Tried to read 4 bytes, but only got 0 bytes.
      26 22:32:44,931 INFO at org.apache.thrift.transport.TTransport.readAll(
      26 22:32:44,931 INFO at org.apache.thrift.protocol.TBinaryProtocol.readAll(
      26 22:32:44,931 INFO at org.apache.thrift.protocol.TBinaryProtocol.readI32(
      26 22:32:44,931 INFO at org.apache.thrift.protocol.TBinaryProtocol.readMessageBegin(
      26 22:32:44,931 INFO at fm.last.catalogue.api.TCatalogueAPI$Client.recv_getTrackById(

      It would be better if the client got the actual TException sent by the server, or at the very least a better error message indicating that an unexpected error occurred on the server (akin to an HTTP 500 message that most web servers use).


        Adrian Woodhead created issue -
        Bryan Duxbury made changes -
        Field Original Value New Value
        Status Open [ 1 ] Closed [ 6 ]
        Assignee Bryan Duxbury [ bryanduxbury ]
        Fix Version/s 0.6 [ 12315359 ]
        Resolution Fixed [ 1 ]


          • Assignee:
            Bryan Duxbury
            Adrian Woodhead
          • Votes:
            0 Vote for this issue
            2 Start watching this issue


            • Created: