Throwing TNonblockingServer exceptions

I have a server application written in java and a client application in groovy. My server receives the request and does it. I am using Thrift with TNonBlockingServer.

    public static void nonBlockingServer(HbaseLayerService.Processor processor) {
            try {
                final Integer serverPort = ConfigurationManager.instance().getServerPort();
                TNonblockingServerTransport serverTransport = new TNonblockingServerSocket(serverPort);
                TServer server = new TNonblockingServer(new TNonblockingServer.Args(serverTransport).processor(processor));

            } catch (Exception e) {


My client is sending data ~ 100 MB

TTransport transport = new TFramedTransport(new TSocket('localhost', 12345, 100000))
TProtocol protocol = new TBinaryProtocol(transport);
HbaseLayerService.Client client = new HbaseLayerService.Client(protocol);
def putList = [] //~1500000 objects (string, string, string, int, byte[])
client.putEvent(new PutEventsOperation(putsToSend));


during this operation I have an error:

Exception in thread "main" org.apache.thrift.transport.TTransportException
    at org.apache.thrift.transport.TTransport.readAll(
    at org.apache.thrift.transport.TFramedTransport.readFrame(
    at org.apache.thrift.transport.TTransport.readAll(
    at org.apache.thrift.protocol.TBinaryProtocol.readAll(
    at org.apache.thrift.protocol.TBinaryProtocol.readI32(
    at org.apache.thrift.protocol.TBinaryProtocol.readMessageBegin(
    at org.apache.thrift.TServiceClient.receiveBase(
    at communication_struct.thrift.HbaseLayerService$Client.recv_putEvent(


This exception is of type 4: END_OF_FILE .

TSimpleServer is fine, but I want to make multiple connections and queued up operation in one thread.


source to share

1 answer

Finally I found a solution. In this particular case, you must add a new dimension to TFramedTransport.Factory

as shown below:

TServer server = new TNonblockingServer(new TNonblockingServer.Args(serverTransport)
                    .transportFactory(new TFramedTransport.Factory(MAX_FRAMED_TRANSPORT_SIZE))
                    .protocolFactory(new TBinaryProtocol.Factory())


The same action should be performed on the client side:

TTransport transport = new TFramedTransport(new TSocket('localhost', 12345), MAX_FRAMED_TRANSPORT_SIZE)


In my case MAX_FRAMED_TRANSPORT_SIZE = 256 * 1024 * 1024




All Articles