Thrift
  1. Thrift
  2. THRIFT-1447

NullpointerException in ProcessFunction.class :in "oneway" method

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 0.8
    • Fix Version/s: 0.9
    • Component/s: Java - Library
    • Labels:
      None
    • Environment:

      Mac OS X Lion 10.7.2
      java version "1.6.0_29"
      Java(TM) SE Runtime Environment (build 1.6.0_29-b11-402-11M3527)
      Java HotSpot(TM) 64-Bit Server VM (build 20.4-b02-402, mixed mode)

      Description

      lines 31-36 of ProcessFunction.class:
      iprot.readMessageEnd();
      TBase result = getResult(iface, args);
      oprot.writeMessageBegin(new TMessage(getMethodName(), TMessageType.REPLY, seqid));
      result.write(oprot);
      oprot.writeMessageEnd();
      oprot.getTransport().flush();

      problem in case where result == null;

      getResult(..) for my "oneway" method(generated code) :
      @Override
      protected org.apache.thrift.TBase getResult(final I iface, final processUA_args args) throws org.apache.thrift.TException

      { iface.processUA(args.appIdNames, args.platform); return null; }

      so it always return null, and crash on 34 lines(ProcessFunction.class)

      1. onewayfix.patch
        2 kB
        Janick Bernet

        Issue Links

          Activity

          Ihor Mysak created issue -
          Hide
          Bryan Duxbury added a comment -

          Hm, this is interesting. It must have gotten changed when we refactored this part of the code a while ago, otherwise oneway functions would never have worked. We probably need to be smart about this - if a non-oneway method returns null, it should be an exception.

          Show
          Bryan Duxbury added a comment - Hm, this is interesting. It must have gotten changed when we refactored this part of the code a while ago, otherwise oneway functions would never have worked. We probably need to be smart about this - if a non-oneway method returns null, it should be an exception.
          Bryan Duxbury made changes -
          Field Original Value New Value
          Fix Version/s 0.9 [ 12316294 ]
          Priority Major [ 3 ] Blocker [ 1 ]
          Jake Farrell made changes -
          Link This issue is duplicated by THRIFT-1511 [ THRIFT-1511 ]
          Hide
          Janick Bernet added a comment -

          I attached a patch with a possible fix to the issue. It uses a new abstract isOneway() method in the ProcessFunction class. The method is implemented by the compiler in a sub-class. The process method only sends back a result when isOneway() returns true, otherwise it does not write anything to the output transport. This should correspond to the old (0.6 and before) behavior from what I could tell looking at the code.

          Show
          Janick Bernet added a comment - I attached a patch with a possible fix to the issue. It uses a new abstract isOneway() method in the ProcessFunction class. The method is implemented by the compiler in a sub-class. The process method only sends back a result when isOneway() returns true, otherwise it does not write anything to the output transport. This should correspond to the old (0.6 and before) behavior from what I could tell looking at the code.
          Janick Bernet made changes -
          Attachment onewayfix.patch [ 12513500 ]
          Hide
          Bryan Duxbury added a comment -

          I just committed this. Thanks for the patch, Ihor!

          Show
          Bryan Duxbury added a comment - I just committed this. Thanks for the patch, Ihor!
          Bryan Duxbury made changes -
          Status Open [ 1 ] Closed [ 6 ]
          Assignee Ihor Mysak [ imysak ]
          Resolution Fixed [ 1 ]
          Hide
          Hudson added a comment -

          Integrated in Thrift #406 (See https://builds.apache.org/job/Thrift/406/)
          THRIFT-1447. java: NullpointerException in ProcessFunction.class :in 'oneway' method

          Patch: Ihor Mysak (Revision 1244272)

          Result = SUCCESS
          bryanduxbury : http://svn.apache.org/viewvc/?view=rev&rev=1244272
          Files :

          • /thrift/trunk/compiler/cpp/src/generate/t_java_generator.cc
          • /thrift/trunk/lib/java/src/org/apache/thrift/ProcessFunction.java
          Show
          Hudson added a comment - Integrated in Thrift #406 (See https://builds.apache.org/job/Thrift/406/ ) THRIFT-1447 . java: NullpointerException in ProcessFunction.class :in 'oneway' method Patch: Ihor Mysak (Revision 1244272) Result = SUCCESS bryanduxbury : http://svn.apache.org/viewvc/?view=rev&rev=1244272 Files : /thrift/trunk/compiler/cpp/src/generate/t_java_generator.cc /thrift/trunk/lib/java/src/org/apache/thrift/ProcessFunction.java
          Hide
          Andre Reiter added a comment -

          hi guys
          the error seams to be fixed since 14.Feb, so the next version 0.9 will contain it
          the question now is, when is the 0.9 going to be released??? this BUG is a blocker!

          Show
          Andre Reiter added a comment - hi guys the error seams to be fixed since 14.Feb, so the next version 0.9 will contain it the question now is, when is the 0.9 going to be released??? this BUG is a blocker!
          Hide
          Jake Farrell added a comment -

          I am waiting on a couple tickets to get finished which are currently being worked on before making the 0.9rc, should be available soon

          Show
          Jake Farrell added a comment - I am waiting on a couple tickets to get finished which are currently being worked on before making the 0.9rc, should be available soon
          Mike Drob made changes -
          Link This issue is depended upon by ACCUMULO-2410 [ ACCUMULO-2410 ]

            People

            • Assignee:
              Ihor Mysak
              Reporter:
              Ihor Mysak
            • Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development