Uploaded image for project: 'TinkerPop'
  1. TinkerPop
  2. TINKERPOP-2241

Client exception don't match Server exception when server throw StackOverflowError

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.4.0, 3.4.2
    • 3.3.8, 3.4.3, 3.5.0
    • server
    • None
    • Mac
    • Important

    Description

      On both apache-tinkerpop-gremlin-console-3.4.2 and older version,when i try a extra-long requests,the client get NPE:java.lang.NullPointerException

      gremlin> g = TinkerGraph.open().traversal()
      ==>graphtraversalsource[tinkergraph[vertices:0 edges:0], standard]
      gremlin> g.addV("1")
      ==>v[0]
      gremlin>g.addV('role').property('name','xxx').property('merchantId',9999).property('creatorId',0).property('modifierId',0).property('createTime',0).property('updateTime',0).property('_classname','com.dding.platform.service.auth.entity.Role').addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV().addE('rolePermissionShip').to(V('1')).outV()
      
      java.lang.NullPointerException
      

      However,the gremlin-server just throw: java.lang.StackOverflowError: null  because of the thread's stack overflow。

      The exception mismatch above is  just because in the server side,  StackOverflowError's getMessage() function will return null ,which cause ResponseMessage.ResponseStatus.message variable assigned to null.

      But the gremlin-driver does not checking (key = serTokens.TOKEN_MESSAGE)'s value, so throw new exception when response deserialization, code snippet as follows:

      // file: AbstractGraphSONMessageSerializerV2d0.java
      public final static class ResponseMessageDeserializer extends AbstractObjectDeserializer<ResponseMessage> {
          protected ResponseMessageDeserializer() {
              super(ResponseMessage.class);
          }
          
          @Override
          public ResponseMessage createObject(final Map<String, Object> data) {
              final Map<String, Object> status = (Map<String, Object>) data.get(SerTokens.TOKEN_STATUS);
              final Map<String, Object> result = (Map<String, Object>) data.get(SerTokens.TOKEN_RESULT);
              return ResponseMessage.build(UUID.fromString(data.get(SerTokens.TOKEN_REQUEST).toString()))
                      .code(ResponseStatusCode.getFromValue((Integer) status.get(SerTokens.TOKEN_CODE)))
                      .statusMessage(status.get(SerTokens.TOKEN_MESSAGE).toString())
                      .statusAttributes((Map<String, Object>) status.get(SerTokens.TOKEN_ATTRIBUTES))
                      .result(result.get(SerTokens.TOKEN_DATA))
                      .responseMetaData((Map<String, Object>) result.get(SerTokens.TOKEN_META))
                      .create();
          }
      }
      

      PR : https://github.com/apache/tinkerpop/pull/1127/files

       

       

      Attachments

        1. image-2019-06-11-19-57-37-659.png
          822 kB
          Stark Arya
        2. image-2019-06-11-20-01-20-982.png
          981 kB
          Stark Arya

        Issue Links

          Activity

            People

              spmallette Stephen Mallette
              Stark Arya Stark Arya
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: