Disable Session Timeout

Hi sir,

          My vaadin application needs to run 24*7/365  format . So I don't need  Session timeout . How to disable ?

Thank you

-1

Hi sir,

      Thank you for your information . It was  greately helpful to me.

Can I ask why you’re doing this? Unless you restart the server occasionally, you will run out of memory since session objects never expire. Every time a user starts your app, a session gets created that never goes away (even if you only have one user, a single memory leak in your app will use all available memory eventually).

Can’t you just store the application state in a database and retrieve it when a user loads the app? If you need some kind of 24 hour processing that keeps the app working, you can do that without keeping sessions around indefinitely.

Cheers,
Bobby

I agree that it makes little sense. Most apps need to be available all the time, but to assume that a user will communicate with your app once, and then not do anything ever again to communicate with the server doesn’t mean you need no session timeout, it implies you can timeout the session immediately. If your app instead gets more user interaction, the session timeout resets, so session timeout is just how long to wait with no communications with the client browser before you can assume they are gone.

Hi all ,
You are correct sir. I already faced the memory leak problem not because of session timeout but some objects are not cleared properly.
Now i turned to default session time out .

Thank you all for valid information.

I also need to use this code, but I don’t know where to place it… Can anyone tell me?

Thanks.
Hugo

It needs to be added to WEB-INF/web.xml

And, again, you are guaranteeing that your server will run out of memory eventually. If you make it so that sessions never time out, make sure you plan to reboot your server every now and then.

Can I ask again: what are you hoping to accomplish with this? There’s no reason to maintain a session for a user who isn’t using it.

Cheers,
Bobby

I use this in my web.xml of Vaadin 7 project.

<session-config> <session-timeout>1</session-timeout> </session-config> But the session is not closing after a minute… any ideas??

I have a background thread running in my app that gets some information from the browser. Will that be a problem?

Update:
Even I stopped the thread and ran my app. Session is not expiring… :frowning:

Wait few more minutes ;-). From my experience, a session expires about 3-7 minutes after the time is set for a timeout.

Nothing happens Agata… I have waited for more than 30 minutes…

And also I use ICEPush in my application. Will that be a reason?

This session expired nonsesne is driving my company to dump Vaadin.
even demos suffer from this nonsense behavior…the reloading of the entire page and session expired red message
No other toolkit has this issue…see this

http://demo.vaadin.com/calendar

and compare to google calendar. the difference a deal breaker. how come the design of vaadin
makes it so obtrusive while the google calendar is so smooth.

Disable session timeout and set cookie
max age
, so that session cookie will be kept in the browser after it is closed, (normaly session cookie is session scoped and disapears after browser restart.)

​        <cookie-config>  
            <max-age>720000</max-age>  
        </cookie-config>  
    </session-config>

this above piece of config - where exactly should I put it?

Put it inside your
web.xml
file. At the session-config section.
here you can find
example
. And here the
docs
.

I dont have web.xml. Can I use annotation for that?

VaadinSession.getCurrent().getSession().setMaxInactiveInterval(300); in

init(VaadinRequest request) {
          VaadinSession.getCurrent().getSession().setMaxInactiveInterval(300); 
           ...
} 

as far as I know, there is no annotation parameter for that.

Thanks. is this set in any UI component? all all of UI components.
each Vaadin session for one UI component?