Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-6706

Websocket Endpoint logs exception when user leaves page

    XMLWordPrintableJSON

Details

    Description

      The Wicket Websocket endpoint seems to log an EOF exception which happens in a very common scenario, namely the user leaves the page:

      2019-10-01 12:15:19 ERROR [SYSTEM] WicketEndpoint - An error occurred in web socket connection with id : 0
      java.io.EOFException: null
      at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.fillReadBuffer(NioEndpoint.java:1206) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
      at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.read(NioEndpoint.java:1140) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
      at org.apache.tomcat.websocket.server.WsFrameServer.onDataAvailable(WsFrameServer.java:72) ~[tomcat-embed-websocket-9.0.17.jar:9.0.17]
      at org.apache.tomcat.websocket.server.WsFrameServer.doOnDataAvailable(WsFrameServer.java:171) ~[tomcat-embed-websocket-9.0.17.jar:9.0.17]
      at org.apache.tomcat.websocket.server.WsFrameServer.notifyDataAvailable(WsFrameServer.java:151) ~[tomcat-embed-websocket-9.0.17.jar:9.0.17]
      at org.apache.tomcat.websocket.server.WsHttpUpgradeHandler.upgradeDispatch(WsHttpUpgradeHandler.java:148) [tomcat-embed-websocket-9.0.17.jar:9.0.17]
      at org.apache.coyote.http11.upgrade.UpgradeProcessorInternal.dispatch(UpgradeProcessorInternal.java:54) [tomcat-embed-core-9.0.17.jar:9.0.17]
      at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:53) [tomcat-embed-core-9.0.17.jar:9.0.17]
      at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:834) [tomcat-embed-core-9.0.17.jar:9.0.17]
      at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1415) [tomcat-embed-core-9.0.17.jar:9.0.17]
      at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.17.jar:9.0.17]
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_181]
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_181]
      at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.17.jar:9.0.17]
      at java.lang.Thread.run(Thread.java:748) [?:1.8.0_181]

      I have looked around on the web to figure out how to avoid this issue and it appears to me that the common solution is to ignore this particular error. So I wonder: would it be reasonable to change the WicketEndpoint onError method to specifically filter out this error:

      @Override
      public void onError(Session session, Throwable t)
      {
      LOG.error("An error occurred in web socket connection with id : " + session.getId(), t); // ADD IF STATEMENT HERE TO NOT LOG EOF EXCEPTIONS
      super.onError(session, t);

      if (isApplicationAlive())

      { javaxWebSocketProcessor.onError(t); }

      }

      Attachments

        Activity

          People

            mgrigorov Martin Tzvetanov Grigorov
            rec Richard Eckart de Castilho
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: