Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-1511

Server with oneway support ( JAVA )

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • None
    • 0.9
    • None

    Description

      Thrift file: ( client to java Server )

      service myService {

      oneway void info ( 1:i32 server_id )

      }

      When I make a request with info, on the java server I get this error:
      22:16:12.553 [pool-3-thread-5] ERROR o.a.thrift.server.TThreadPoolServer - Error occurred during processing of message.
      java.lang.NullPointerException: null
      at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:34) ~[libthrift-0.9.0-snapshot.jar:0.9.0-snapshot]
      at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:34) ~[libthrift-0.9.0-snapshot.jar:0.9.0-snapshot]
      at org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:176) ~[libthrift-0.9.0-snapshot.jar:0.9.0-snapshot]
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [na:1.7.0_01]
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [na:1.7.0_01]
      at java.lang.Thread.run(Thread.java:722) [na:1.7.0_01]

      On line 34 of ProcessFunction we have: result.write(oprot); but result is null, becouse when the func is oneway, getResult's response is always null
      TBase result = getResult(iface, args);
      oprot.writeMessageBegin(new TMessage(getMethodName(), TMessageType.REPLY, seqid));
      result.write(oprot);

      getResult funcion is:
      public info_result getResult(I iface, info_args args) throws org.apache.thrift.TException

      { iface.info(args.server_id); return null; }

      instead without oneway it is:
      public info_result getResult(I iface, info_args args) throws org.apache.thrift.TException

      { info_result result = new info_result(); iface.info(args.server_id); return result; }

      Attachments

        Issue Links

          Activity

            People

              jfarrell Jake Farrell
              fre93 Francesco Capponi
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: