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

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

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.5.0
    • Fix Version/s: 1.6.0
    • Component/s: avatica
    • Labels:
      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.

        Activity

        Hide
        julianhyde Julian Hyde added a comment -

        Resolved in release 1.6.0 (2016-01-22).

        Show
        julianhyde Julian Hyde added a comment - Resolved in release 1.6.0 (2016-01-22).
        Show
        elserj Josh Elser added a comment - Fixed in https://github.com/apache/calcite/commit/d1c72b80c67814f670a3d87580f44f913c4eb0e5

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development