glassfish
  1. glassfish
  2. GLASSFISH-20481

GlassFish does not log exceptions thrown by WebSocket callback methods

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.0_dev
    • Fix Version/s: 4.1
    • Component/s: web_socket
    • Labels:
      None

      Description

      If a webSocket @OnMessage callback throws a RuntimeException this is ignored by the container and nothing is logged in the server log to indicate that anything went wrong. This can lead to important failures being completely missed.

      Here's an example of a webSocket @OnMessage callback that throws a {{RuntimeException}:

          @OnMessage
          public void onMessage(final String message, final Session client) {
              Logger.getLogger(SampleWebSocket.class.getName()).log(Level.INFO, "SampleWebSocket.onMessage called");
              throw new RuntimeException("Ooh la la");
          }
      

      I think this is a bug in GlassFish. If a RuntimeException exception is thrown by a EJB business method then GlassFish logs it (with a stack trace) in the server log. However if a RuntimeException exception is thrown in a WebSocket callback then nothing is logged.

        Issue Links

          Activity

          Nigel Deakin created issue -
          Nigel Deakin made changes -
          Field Original Value New Value
          Link This issue is related to MQ-297 [ MQ-297 ]
          Nigel Deakin made changes -
          Description If a webSocket {{@OnMessage}} callback throws a {{RuntimeException} this is ignored by the container and nothing is logged in the server log to indicate that anything went wrong. This can lead to important failures being completely missed.

          Here's an example of a webSocket {{@OnMessage}} callback that throws a {{RuntimeException}:

          {noformat}
              @OnMessage
              public void onMessage(final String message, final Session client) {
                  Logger.getLogger(SampleWebSocket.class.getName()).log(Level.INFO, "SampleWebSocket.onMessage called");
                  throw new RuntimeException("Ooh la la");
              }
          {noformat}

          I think this is a bug in GlassFish. If a {{RuntimeException}} exception is thrown by a EJB business method then GlassFish logs it (with a stack trace) in the server log. However if a {{RuntimeException}} exception is thrown in a WebSocket callback then nothing is logged.
          If a webSocket {{@OnMessage}} callback throws a {{RuntimeException}} this is ignored by the container and nothing is logged in the server log to indicate that anything went wrong. This can lead to important failures being completely missed.

          Here's an example of a webSocket {{@OnMessage}} callback that throws a {{RuntimeException}:

          {noformat}
              @OnMessage
              public void onMessage(final String message, final Session client) {
                  Logger.getLogger(SampleWebSocket.class.getName()).log(Level.INFO, "SampleWebSocket.onMessage called");
                  throw new RuntimeException("Ooh la la");
              }
          {noformat}

          I think this is a bug in GlassFish. If a {{RuntimeException}} exception is thrown by a EJB business method then GlassFish logs it (with a stack trace) in the server log. However if a {{RuntimeException}} exception is thrown in a WebSocket callback then nothing is logged.
          Nigel Deakin made changes -
          Link This issue is related to GLASSFISH-20467 [ GLASSFISH-20467 ]
          michael.y.chen made changes -
          Assignee michael.y.chen [ michael.y.chen ] Dhiru Pandey [ dhirup ]
          Dhiru Pandey made changes -
          Assignee Dhiru Pandey [ dhirup ] stepan.kopriva [ stepan.kopriva ]
          stepan.kopriva made changes -
          Fix Version/s 4.0.1 [ 16061 ]
          stepan.kopriva made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Romain Grécourt made changes -
          Fix Version/s 4.1 [ 16387 ]
          Fix Version/s 4.0.1 [ 16061 ]
          Joe Di Pol made changes -
          Affects Version/s 4.0_dev [ 17784 ]

            People

            • Assignee:
              stepan.kopriva
              Reporter:
              Nigel Deakin
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: