On Wed, Feb 8, 2017 at 2:03 PM, Peter Henderson <[email protected] > wrote:
> Thanks Martin, > > On 8 February 2017 at 10:45, Martin Grigorov <[email protected]> wrote: > > > Hi, > > > > The WebSocket communication doesn't update the session, i.e. doesn't > renew > > it. This is by Servlet specification. > > So if there is no normal HTTP request then the http session will expire > and > > Wicket will clean up its resources. > > Later when a web socket message comes it might fail with such kind of > > error. > > > > I've done a little more analysis of the logs and my code. > > It seems this happened to only 1 used yesterday. > Tracking her session ID she logs in, 7 hours later her session times out. > > My code has a HttpSessionListener which sends a message to an actor which > monitors sessions. This actor eventually does a web socket broadcast to > notify everyone who is online. > > Could there be a race condition when sessions are being destroyed and > sending web socket push messages? > Wicket also uses HttpSessionListener to be notified when to cleanup the user's resources. It might be that your listener is notified later than Wicket's one. You may try using Wicket's callbacks instead: Session#onInvalidate(), Application#sessionUnbound() / org.apache.wicket.Application#getSessionListeners().add(...) > > > > > > > > > I am not sure what is the best solution to this. > > There is an established web socket connection and there won't be a new > > handshake when the message arrives. > > The only workaround I see is to make a ping once per N minutes, where N > is > > less than the session timeout duration. > > > > When their session goes, does Tomcat & the browser keep a web socket > connection open. > I'm not sure but it should be very easy to test! > > Perhaps the simplest option is for me to mute DiskDataStore exception log > messages. > > > > > > > But the exception in the DiskDataStore happens in a different thread, so > I > > think it should not affect the thread where the application reads/writes > to > > the websocket connection. > > > > Martin Grigorov > > Wicket Training and Consulting > > https://twitter.com/mtgrigorov > > > > On Wed, Feb 8, 2017 at 9:46 AM, Peter Henderson < > > [email protected] > > > wrote: > > > > > Morning all. > > > > > > Wicket 7.6.0 > > > Tomcat 8.5.11 > > > Java 1.8.0_121 > > > > > > > > > > > > I'm seeing several DiskDataStore Exceptions [1]. Normally towards the > end > > > of the day, long after users have stopped using my app. So probably > when > > > their sessions time out. > > > The file name looks very suspicious to me. > > > /opt/starjar/domains/customer/apache-tomcat-8.5.11/work/ > > > Catalina/localhost/Starjar/Key[type=org.apache.wicket. > protocol.ws.javax. > > > JavaxWebSocketFilter, > > > annotation=[none]]-filestore/247/7021/D69E0EE552DC1F1FE5FF986A1A919C > > > 39/data > > > > > > > > > > > > Another perhaps unrelated exception [2] > > > > > > > > > Any pointers where I should dig to solve this ? > > > > > > Thanks > > > Peter > > > > > > > > > > > > > > > > > > [1] > > > 2017-02-07 20:59:34.358 SEVERE oawp.DiskDataStore > > > /opt/starjar/domains/viper/apache-tomcat-8.5.11/work/ > > > Catalina/localhost/Starjar/Key[type=org.apache.wicket. > protocol.ws.javax. > > > JavaxWebSocketFilter, > > > annotation=[none]]-filesto > > > re/247/7021/D69E0EE552DC1F1FE5FF986A1A919C39/data (No such file or > > > directory) > > > java.io.FileNotFoundException: > > > /opt/starjar/domains/customer/apache-tomcat-8.5.11/work/ > > > Catalina/localhost/Starjar/Key[type=org.apache.wicket. > protocol.ws.javax. > > > JavaxWebSocketFilter, > > > annotation=[none]]-filestore/247/7021/D69E0EE552DC1F1FE5FF986A1A919C > > > 39/data > > > (No such file or directory) > > > at java.io.RandomAccessFile.open0(Native Method) > > > at java.io.RandomAccessFile.open(RandomAccessFile.java:316) > > > at java.io.RandomAccessFile.<init>(RandomAccessFile.java:243) > > > at > > > org.apache.wicket.pageStore.DiskDataStore$SessionEntry. > > > getFileChannel(DiskDataStore.java:432) > > > at > > > org.apache.wicket.pageStore.DiskDataStore$SessionEntry. > > > savePage(DiskDataStore.java:350) > > > at > > > org.apache.wicket.pageStore.DiskDataStore.storeData( > > > DiskDataStore.java:188) > > > at > > > org.apache.wicket.pageStore.AsynchronousDataStore$ > > PageSavingRunnable.run( > > > AsynchronousDataStore.java:355) > > > at java.lang.Thread.run(Thread.java:745) > > > > > > > > > > > > > > > > > > > > > [2] > > > 2017-02-07 21:33:52.127 SEVERE oawpwj.WicketEndpoint An error occurred > in > > > web socket connection with id : 5c1c > > > java.io.EOFException > > > at > > > org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper. > > > fillReadBuffer(NioEndpoint.java:1221) > > > at > > > org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper. > > > fillReadBuffer(NioEndpoint.java:1192) > > > at > > > org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper. > > > read(NioEndpoint.java:1165) > > > at > > > org.apache.tomcat.websocket.server.WsFrameServer. > > > onDataAvailable(WsFrameServer.java:63) > > > at > > > org.apache.tomcat.websocket.server.WsHttpUpgradeHandler. > upgradeDispatch( > > > WsHttpUpgradeHandler.java:148) > > > at > > > org.apache.coyote.http11.upgrade.UpgradeProcessorInternal.dispatch( > > > UpgradeProcessorInternal.java:54) > > > at > > > org.apache.coyote.AbstractProcessorLight.process( > > > AbstractProcessorLight.java:53) > > > at > > > org.apache.coyote.AbstractProtocol$ConnectionHandler.process( > > > AbstractProtocol.java:798) > > > at > > > org.apache.tomcat.util.net.NioEndpoint$SocketProcessor. > > > doRun(NioEndpoint.java:1434) > > > at > > > org.apache.tomcat.util.net.SocketProcessorBase.run( > > > SocketProcessorBase.java:49) > > > at > > > java.util.concurrent.ThreadPoolExecutor.runWorker( > > > ThreadPoolExecutor.java:1142) > > > at > > > java.util.concurrent.ThreadPoolExecutor$Worker.run( > > > ThreadPoolExecutor.java:617) > > > at > > > org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run( > > > TaskThread.java:61) > > > at java.lang.Thread.run(Thread.java:745) > > > > > > > > > > > > -- > > > Peter Henderson > > > > > > > > > -- > Peter Henderson > > Director > Starjar Ltd. > www.starjar.com > 0330 088 1662 >
