You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Bergmann Manfred <mb...@software-by-mabe.com> on 2017/09/15 15:05:51 UTC

WebSocket and timeout

Hi.

I’m having a problem with WebSocket timeouts.
One panel (currently) of a page uses a WebSocket to push data and re-render something.
Leaving the browser untouched the WebSocket will timeout after 5 minutes:
—-
[ERROR] 2017-09-15 16:57:46.566 [Scheduler-1197176722] org.apa.wic.pro.ws.jav.WicketEndpoint onError - An error occurred in web socket connection with id : 0:0:0:0:0:0:0:1:8080->0:0:0:0:0:0:0:1:55737
java.net.SocketTimeoutException: Timeout on Read
	at org.eclipse.jetty.websocket.common.io.AbstractWebSocketConnection.onReadTimeout(AbstractWebSocketConnection.java:592) [websocket-common-9.4.6.v20170531.jar:9.4.6.v20170531]
	at org.eclipse.jetty.io.AbstractConnection.onFillInterestedFailed(AbstractConnection.java:170) [jetty-io-9.4.6.v20170531.jar:9.4.6.v20170531]
	at org.eclipse.jetty.websocket.common.io.AbstractWebSocketConnection.onFillInterestedFailed(AbstractWebSocketConnection.java:538) [websocket-common-9.4.6.v20170531.jar:9.4.6.v20170531]
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.failed(AbstractConnection.java:285) [jetty-io-9.4.6.v20170531.jar:9.4.6.v20170531]
	at org.eclipse.jetty.io.FillInterest.onFail(FillInterest.java:140) [jetty-io-9.4.6.v20170531.jar:9.4.6.v20170531]
	at org.eclipse.jetty.io.AbstractEndPoint.onIdleExpired(AbstractEndPoint.java:398) [jetty-io-9.4.6.v20170531.jar:9.4.6.v20170531]
	at org.eclipse.jetty.io.IdleTimeout.checkIdleTimeout(IdleTimeout.java:166) [jetty-io-9.4.6.v20170531.jar:9.4.6.v20170531]
—-

Now, what exactly is responsible for this timeout. And how can that be adjusted?



Regards,
Manfred


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: WebSocket and timeout

Posted by Maxim Solodovnik <so...@gmail.com>.
you can add timeout behavior which will send ajax requests
these requests will refresh session

So far this is the only workaround i can propose

On Fri, Sep 15, 2017 at 11:53 PM, Manfred Bergmann
<mb...@software-by-mabe.com> wrote:
> Hi.
>
> I'm not exactly certain how that helps me, except that the not yet released
> version 7.8.1 fixes something regarding WebSockets. But I don't know if it's
> that.
>
> The thing is, that I have a one page application. Meaning the page itself
> doesn't ever refresh. Only panels are reloaded here and there via Ajax.
> One of those panels uses a WebSocket.
> The WebSocket times out even if I move away from this particular panel.
> After the WebSocket has timed out it's only to possible to really reload the
> page to re-activate it.
>
> So, preferably I'd like to WebSocket to not expire before the session
> expired.
>
>
> Manfred
>
> --
> Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>



-- 
WBR
Maxim aka solomax

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: WebSocket and timeout

Posted by Manfred Bergmann <mb...@software-by-mabe.com>.
Hi.

I'm not exactly certain how that helps me, except that the not yet released
version 7.8.1 fixes something regarding WebSockets. But I don't know if it's
that.

The thing is, that I have a one page application. Meaning the page itself
doesn't ever refresh. Only panels are reloaded here and there via Ajax.
One of those panels uses a WebSocket.
The WebSocket times out even if I move away from this particular panel.
After the WebSocket has timed out it's only to possible to really reload the
page to re-activate it.

So, preferably I'd like to WebSocket to not expire before the session
expired.


Manfred

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: WebSocket and timeout

Posted by Maxim Solodovnik <so...@gmail.com>.
According to tomcat user list web socket activity does not touch session
You can set timeout ping behavior to touch the session

Here is the thread with my question according this
http://markmail.org/thread/g2ao4a4ytc3322b5

On Fri, Sep 15, 2017 at 10:05 PM, Bergmann Manfred
<mb...@software-by-mabe.com> wrote:
> Hi.
>
> I’m having a problem with WebSocket timeouts.
> One panel (currently) of a page uses a WebSocket to push data and re-render something.
> Leaving the browser untouched the WebSocket will timeout after 5 minutes:
> —-
> [ERROR] 2017-09-15 16:57:46.566 [Scheduler-1197176722] org.apa.wic.pro.ws.jav.WicketEndpoint onError - An error occurred in web socket connection with id : 0:0:0:0:0:0:0:1:8080->0:0:0:0:0:0:0:1:55737
> java.net.SocketTimeoutException: Timeout on Read
>         at org.eclipse.jetty.websocket.common.io.AbstractWebSocketConnection.onReadTimeout(AbstractWebSocketConnection.java:592) [websocket-common-9.4.6.v20170531.jar:9.4.6.v20170531]
>         at org.eclipse.jetty.io.AbstractConnection.onFillInterestedFailed(AbstractConnection.java:170) [jetty-io-9.4.6.v20170531.jar:9.4.6.v20170531]
>         at org.eclipse.jetty.websocket.common.io.AbstractWebSocketConnection.onFillInterestedFailed(AbstractWebSocketConnection.java:538) [websocket-common-9.4.6.v20170531.jar:9.4.6.v20170531]
>         at org.eclipse.jetty.io.AbstractConnection$ReadCallback.failed(AbstractConnection.java:285) [jetty-io-9.4.6.v20170531.jar:9.4.6.v20170531]
>         at org.eclipse.jetty.io.FillInterest.onFail(FillInterest.java:140) [jetty-io-9.4.6.v20170531.jar:9.4.6.v20170531]
>         at org.eclipse.jetty.io.AbstractEndPoint.onIdleExpired(AbstractEndPoint.java:398) [jetty-io-9.4.6.v20170531.jar:9.4.6.v20170531]
>         at org.eclipse.jetty.io.IdleTimeout.checkIdleTimeout(IdleTimeout.java:166) [jetty-io-9.4.6.v20170531.jar:9.4.6.v20170531]
> —-
>
> Now, what exactly is responsible for this timeout. And how can that be adjusted?
>
>
>
> Regards,
> Manfred
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>



-- 
WBR
Maxim aka solomax

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: WebSocket and timeout

Posted by Maxim Solodovnik <so...@gmail.com>.
Sorry,
Misread it :(
I actually using both.
Ajax request refreshing HTTP session and binary ping refreshing websocket
connection and being ignored

WBR, Maxim
(from mobile, sorry for the typos)

On Sep 19, 2017 02:49, "Martin Grigorov" <mg...@apache.org> wrote:

> Hi,
>
> @Maxim: the problem Manfred faces is not that the Http Session expires but
> that the WebSocket connection is closed by the web container due to
> inactivity.
>
> @Manfred: I'd use server-side timer that uses the
> IWebSocketConnectionRegistry to send the heartbeat message to all connected
> clients. The clients should ignore this message.
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Mon, Sep 18, 2017 at 8:55 AM, Maxim Solodovnik <so...@gmail.com>
> wrote:
>
> > Hello Manfred,
> >
> > AFAIK websocket ping messages will not update HTTP session.
> > You can set up AbstractAjaxTimerBehavior or send pure JS HTTP request
> > to refresh the session
> >
> > On Sat, Sep 16, 2017 at 7:34 PM, Manfred Bergmann
> > <mb...@software-by-mabe.com> wrote:
> > >
> > > Hi,
> > >
> > > On Sat, Sep 16, 2017 at 1:32 PM, Manfred Bergmann &lt;mb@&gt;
> > > wrote:
> > >
> > >> Found a different solution.
> > >>
> > >> Followed the advice here:
> > >> https://issues.apache.org/jira/browse/WICKET-5453
> > >>
> > >> Where you can set the default idle timeout on the
> > >> WebSocketServerContainerInitializer.
> > >>
> > >
> > > This is a good start!
> > > But if there is a proxy involved then you will need to do the same
> there
> > > too.
> > > Better send heartbeat messages once in a while, e.g. every minute.
> > >
> > >
> > >
> > > OK. I'm not exactly certain how I would do that.
> > > Do you mean a timer on the server side which sends some message over
> the
> > > websocket,
> > > or some behavior, as suggested by Maxim?
> > >
> > > How do I handle that when the panel got disposed?
> > >
> > >
> > > Manfred
> > >
> > > --
> > > Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-
> > f1842947.html
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > For additional commands, e-mail: users-help@wicket.apache.org
> > >
> >
> >
> >
> > --
> > WBR
> > Maxim aka solomax
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>

Re: WebSocket and timeout

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

@Maxim: the problem Manfred faces is not that the Http Session expires but
that the WebSocket connection is closed by the web container due to
inactivity.

@Manfred: I'd use server-side timer that uses the
IWebSocketConnectionRegistry to send the heartbeat message to all connected
clients. The clients should ignore this message.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Mon, Sep 18, 2017 at 8:55 AM, Maxim Solodovnik <so...@gmail.com>
wrote:

> Hello Manfred,
>
> AFAIK websocket ping messages will not update HTTP session.
> You can set up AbstractAjaxTimerBehavior or send pure JS HTTP request
> to refresh the session
>
> On Sat, Sep 16, 2017 at 7:34 PM, Manfred Bergmann
> <mb...@software-by-mabe.com> wrote:
> >
> > Hi,
> >
> > On Sat, Sep 16, 2017 at 1:32 PM, Manfred Bergmann &lt;mb@&gt;
> > wrote:
> >
> >> Found a different solution.
> >>
> >> Followed the advice here:
> >> https://issues.apache.org/jira/browse/WICKET-5453
> >>
> >> Where you can set the default idle timeout on the
> >> WebSocketServerContainerInitializer.
> >>
> >
> > This is a good start!
> > But if there is a proxy involved then you will need to do the same there
> > too.
> > Better send heartbeat messages once in a while, e.g. every minute.
> >
> >
> >
> > OK. I'm not exactly certain how I would do that.
> > Do you mean a timer on the server side which sends some message over the
> > websocket,
> > or some behavior, as suggested by Maxim?
> >
> > How do I handle that when the panel got disposed?
> >
> >
> > Manfred
> >
> > --
> > Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-
> f1842947.html
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
>
>
>
> --
> WBR
> Maxim aka solomax
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: WebSocket and timeout

Posted by Maxim Solodovnik <so...@gmail.com>.
Hello Manfred,

AFAIK websocket ping messages will not update HTTP session.
You can set up AbstractAjaxTimerBehavior or send pure JS HTTP request
to refresh the session

On Sat, Sep 16, 2017 at 7:34 PM, Manfred Bergmann
<mb...@software-by-mabe.com> wrote:
>
> Hi,
>
> On Sat, Sep 16, 2017 at 1:32 PM, Manfred Bergmann &lt;mb@&gt;
> wrote:
>
>> Found a different solution.
>>
>> Followed the advice here:
>> https://issues.apache.org/jira/browse/WICKET-5453
>>
>> Where you can set the default idle timeout on the
>> WebSocketServerContainerInitializer.
>>
>
> This is a good start!
> But if there is a proxy involved then you will need to do the same there
> too.
> Better send heartbeat messages once in a while, e.g. every minute.
>
>
>
> OK. I'm not exactly certain how I would do that.
> Do you mean a timer on the server side which sends some message over the
> websocket,
> or some behavior, as suggested by Maxim?
>
> How do I handle that when the panel got disposed?
>
>
> Manfred
>
> --
> Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>



-- 
WBR
Maxim aka solomax

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: WebSocket and timeout

Posted by Manfred Bergmann <mb...@software-by-mabe.com>.
Hi,

On Sat, Sep 16, 2017 at 1:32 PM, Manfred Bergmann &lt;mb@&gt;
wrote:

> Found a different solution.
>
> Followed the advice here:
> https://issues.apache.org/jira/browse/WICKET-5453
>
> Where you can set the default idle timeout on the
> WebSocketServerContainerInitializer.
>

This is a good start!
But if there is a proxy involved then you will need to do the same there
too.
Better send heartbeat messages once in a while, e.g. every minute.



OK. I'm not exactly certain how I would do that.
Do you mean a timer on the server side which sends some message over the
websocket,
or some behavior, as suggested by Maxim?

How do I handle that when the panel got disposed?


Manfred

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: WebSocket and timeout

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

On Sat, Sep 16, 2017 at 1:32 PM, Manfred Bergmann <mb...@software-by-mabe.com>
wrote:

> Found a different solution.
>
> Followed the advice here:
> https://issues.apache.org/jira/browse/WICKET-5453
>
> Where you can set the default idle timeout on the
> WebSocketServerContainerInitializer.
>

This is a good start!
But if there is a proxy involved then you will need to do the same there
too.
Better send heartbeat messages once in a while, e.g. every minute.


>
>
>
> Manfred
>
> --
> Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-
> f1842947.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: WebSocket and timeout

Posted by Manfred Bergmann <mb...@software-by-mabe.com>.
Found a different solution.

Followed the advice here:
https://issues.apache.org/jira/browse/WICKET-5453

Where you can set the default idle timeout on the
WebSocketServerContainerInitializer.



Manfred

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org