Does push need org.atmosphere.cpr.SessionSupport defined as a listener in w

I noted this warning in the startup for atmosphere/push:

WARNING: SessionSupport error. Make sure you define org.atmosphere.cpr.SessionSupport as a listener in web.xml instead

Am I supposed to add something to my web.xml for push to work correctly in Vaadin?

For above and below, I’m running Java 1.8.0_25 on Tomcat 8.0.15 with Vaadin 7.3.5.

A follow-up question, since I just noted that when I logoff my application now, two sessions are started:



2014-11-26 21:38:05,645 DEBUG (com.esignforms.open.vaadin.EsfVaadinUI) close()
2014-11-26 21:38:05,649 DEBUG (com.esignforms.open.vaadin.EsfVaadinUI) detach()
2014-11-26 21:38:05,757 DEBUG (com.esignforms.open.servlet.SessionListener) SessionListener() - Session destroyed: 83392E17093016106968F71550AC55D3
2014-11-26 21:38:05,777 DEBUG (com.esignforms.open.servlet.SessionListener) SessionListener() - Session created: 0F7B12C99CAEDB447F38BAAFDC746B3A
2014-11-26 21:38:05,861 DEBUG (com.esignforms.open.servlet.SessionListener) SessionListener() - Session created: D5EE62AF6E5FC08423CF7B507BCB3DD9

When push is not ‘automatic’, I do not see these two sessions starting up.

If I disable push it won’t start those two sessions when I logoff.

What might be causing that?

What’s odd is that one of them appears to be tied back to my browser, because if I login again, I noted it’s using the second session id.

No answers, but here’s what I’ve found over far too many trial and errors.

In your web.xml, add the listener for Atmosphere. I don’t know if it helps or not, but the warning goes away.

<listener>
    <listener-class>org.atmosphere.cpr.SessionSupport</listener-class>
</listener>

As for the extra sessions, it seems that PUSH causes sessions to start over again. The only way I can make this work is on user logoff request, first turn off PUSH on all UIs, then tell them all to logoff, then end the session:

        // Hack to turn off PUSH on all UIs first. Doing it this way to try to avoid spurious PUSH sessions reactivating.
        for( final UI ui : VaadinSession.getCurrent().getUIs() ) {
            ui.access(new Runnable() {
                @Override
                public void run() {
                    ui.getPushConfiguration().setPushMode(PushMode.DISABLED);
                }
            });
        }
        // Force all UIs to be logged off when any UI logs off
        for( final UI ui : VaadinSession.getCurrent().getUIs() ) {
            ui.access(new Runnable() {
                @Override
                public void run() {
                    if ( ui instanceof EsfVaadinUI ) {
                        EsfVaadinUI vui = (EsfVaadinUI)ui;
                        vui.setLogoffUrlNormal();
                        vui.getPage().setLocation(logoutUrl); // set the logoff page before we close the session
                    }
                }
            });
        }
        
        VaadinSession.getCurrent().close();

I tried just disabling push mode when I also do the setLocation(logoutUrl) – using just one UI loop – but that didn’t work as I’d still get an extra session from time to time. I’m sure it was some sort of timing issue. With the two loops, I’ve not seen that happen (yet!).

Sure enough, adding the atmosphere listener in web.xml eliminates a warning message in the logs.

      <!--
    Steve - Feb 12th, 2015:
    Attempting to get rid of a warning message in the logs:
    Feb 12, 2015 7:26:00 AM org.atmosphere.cpr.AtmosphereFramework doInitParams
   WARNING: SessionSupport error. Make sure you define org.atmosphere.cpr.SessionSupport as a listener in web.xml instead   
    https://github.com/Atmosphere/atmosphere/wiki/Enabling-HttpSession-Support
      -->

<listener>
    <listener-class>org.atmosphere.cpr.SessionSupport</listener-class>
</listener>

<context-param>
    <param-name>org.atmosphere.cpr.sessionSupport</param-name>
    <param-value>true</param-value>
</context-param>

I was hoping this might have an effect on the errors encountered pushing to a UI that has closed, but not yet been detached - as in ticket
#14280
and my post
here
, but no joy on that yet.

Can anybody at Vaadin confirm if this listener and context-param is still necessary, or if it can cause it’s own issues with multiple libraries trying to control heartbeats, session timeout, etc.? We still see occasional oddities in which items added to our session are not found even though it does not appear the user logged off, but with websockets we cannot as easily see all web server interactions via tomcat’s access logs.

Sadly, Vaadin never provided an answer to this, so it’s still unclear if we need these in our web.xml to help or hurt things:

[font=courier new]

org.atmosphere.cpr.sessionSupport
true

org.atmosphere.cpr.SessionSupport [/font]

The
warning has been disabled
in more recent versions of the Vaadin branch of Atmosphere and apparently the listener is not needed, although I am not sufficiently familiar with the Atmosphere integration to be able to tell why it is not needed.

Apparently the listener only exists to clean up some references from the session and to the session. The references from the session attributes to Atmosphere should not be an issue as the session gets garbage collected, and I’d assume the references to the session get cleaned up some other way if they need to be cleaned. However, if everything works for you and you want to minimize changes to minimize risks, I believe the listener won’t hurt, either.

Thanks, Henri. I’ll see what it means to remove them and monitor for anything unusual that results.

We have removed them and we don’t notice any issues, so I think they are no longer needed as you suggested. Thanks again!