Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-962

Server-side exception (stack trace) not propagated in JdbcMeta.propagate

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.5.0
    • 1.6.0
    • avatica
    • None

    Description

      Noticed the following in some automated tests against Phoenix:

      java.lang.RuntimeException: Encountered exception in sub plan [0] execution.
        at org.apache.calcite.avatica.jdbc.JdbcMeta.propagate(JdbcMeta.java:645)
        at org.apache.calcite.avatica.jdbc.JdbcMeta.prepareAndExecute(JdbcMeta.java:709)
        at org.apache.calcite.avatica.remote.LocalService.apply(LocalService.java:179)
        at org.apache.calcite.avatica.remote.Service$PrepareAndExecuteRequest.accept(Service.java:1049)
        at org.apache.calcite.avatica.remote.Service$PrepareAndExecuteRequest.accept(Service.java:1023)
        at org.apache.calcite.avatica.remote.AbstractHandler.apply(AbstractHandler.java:100)
        at org.apache.calcite.avatica.remote.JsonHandler.apply(JsonHandler.java:43)
        at org.apache.calcite.avatica.server.AvaticaHandler.handle(AvaticaHandler.java:68)
        at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52)
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
        at org.eclipse.jetty.server.Server.handle(Server.java:497)
        at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)
        at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:245)
        at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
        at java.lang.Thread.run(Thread.java:745)
      

      The good part, we got this exception from the server on the client! Oddly, we didn't get an actual exception from Phoenix. It looks like we happened to drop that context.

      private RuntimeException propagate(Throwable e) {
        if (e instanceof RuntimeException) {
          throw (RuntimeException) e;
        } else if (e instanceof Error) {
          throw (Error) e;
        } else {
          throw new RuntimeException(e.getMessage());
        }
      }
      

      The else branch happened to drop the context from the cause. We want to be sure to propagate this back to clients.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            elserj Josh Elser
            elserj Josh Elser
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment