Vaadin CDI + Wildfly + Push

Hi,
I’m using Vaadin 7.3.0 and CDI addon latest snapshot (builded from source from github). In my project don’t use Push and I don’t even have dependency to vaadin-push. Everything is working as expected, but when I leave application in idle state for some time, I get exception:

2014-09-07 17:55:17,174 ERROR [stderr] (default task-32) Exception in thread "default task-32" java.lang.NullPointerException 2014-09-07 17:55:17,177 ERROR [stderr] (default task-32) at org.apache.deltaspike.core.util.context.AbstractContext.get(AbstractContext.java:115) 2014-09-07 17:55:17,178 ERROR [stderr] (default task-32) at org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:98) 2014-09-07 17:55:17,179 ERROR [stderr] (default task-32) at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:78) 2014-09-07 17:55:17,180 ERROR [stderr] (default task-32) at com.zipsoft.ekarton.ui.MainUI$Proxy$_$$_WeldClientProxy.getPushConfiguration(Unknown Source) 2014-09-07 17:55:17,181 ERROR [stderr] (default task-32) at com.vaadin.server.VaadinSession.unlock(VaadinSession.java:1016) 2014-09-07 17:55:17,182 ERROR [stderr] (default task-32) at com.vaadin.server.VaadinSession.accessSynchronously(VaadinSession.java:1350) 2014-09-07 17:55:17,183 ERROR [stderr] (default task-32) at com.vaadin.server.VaadinService.fireSessionDestroy(VaadinService.java:449) 2014-09-07 17:55:17,184 ERROR [stderr] (default task-32) at com.vaadin.server.VaadinSession.valueUnbound(VaadinSession.java:323) 2014-09-07 17:55:17,185 ERROR [stderr] (default task-32) at io.undertow.servlet.core.SessionListenerBridge.attributeRemoved(SessionListenerBridge.java:104) 2014-09-07 17:55:17,186 ERROR [stderr] (default task-32) at io.undertow.server.session.SessionListeners.attributeRemoved(SessionListeners.java:59) 2014-09-07 17:55:17,187 ERROR [stderr] (default task-32) at io.undertow.server.session.InMemorySessionManager$SessionImpl.removeAttribute(InMemorySessionManager.java:358) 2014-09-07 17:55:17,188 ERROR [stderr] (default task-32) at io.undertow.servlet.core.SessionListenerBridge.sessionDestroyed(SessionListenerBridge.java:53) 2014-09-07 17:55:17,189 ERROR [stderr] (default task-32) at io.undertow.server.session.SessionListeners.sessionDestroyed(SessionListeners.java:38) 2014-09-07 17:55:17,190 ERROR [stderr] (default task-32) at io.undertow.server.session.InMemorySessionManager$SessionImpl.invalidate(InMemorySessionManager.java:379) 2014-09-07 17:55:17,190 ERROR [stderr] (default task-32) at io.undertow.server.session.InMemorySessionManager$SessionImpl$1$1.run(InMemorySessionManager.java:231) 2014-09-07 17:55:17,190 ERROR [stderr] (default task-32) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) 2014-09-07 17:55:17,191 ERROR [stderr] (default task-32) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) 2014-09-07 17:55:17,191 ERROR [stderr] (default task-32) at java.lang.Thread.run(Thread.java:745) When I add vaadin-push dependency, everything is fine. So that is an easy fix.

Then I decided to try using push. Application was working normaly, but when I close browser tab or refresh page I get this exception:

[code]
2014-09-07 18:29:50,416 SEVERE [org.atmosphere.container.JSR356Endpoint]
(default I/O-4) : java.nio.channels.ClosedChannelException
at io.undertow.server.protocol.framed.AbstractFramedChannel.receive(AbstractFramedChannel.java:260)
at io.undertow.websockets.core.AbstractReceiveListener.handleEvent(AbstractReceiveListener.java:20)
at io.undertow.websockets.core.AbstractReceiveListener.handleEvent(AbstractReceiveListener.java:15)
at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) [xnio-api-3.2.2.Final.jar:3.2.2.Final]

at io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:632)
at io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:618)
at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) [xnio-api-3.2.2.Final.jar:3.2.2.Final]

at org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66) [xnio-api-3.2.2.Final.jar:3.2.2.Final]

at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:87) [xnio-nio-3.2.2.Final.jar:3.2.2.Final]

at org.xnio.nio.WorkerThread.run(WorkerThread.java:539) [xnio-nio-3.2.2.Final.jar:3.2.2.Final]

[/code]I trace this to https://github.com/Atmosphere/atmosphere/issues/1550. I have compared atmosphere fixed source with vaadin version of atmosphere frameowork and the fix is applied. From there, I trace exception to https://issues.jboss.org/browse/UNDERTOW-216 and it was resolved in undertow versions 1.0.4.Final, 1.1.Beta1. Wildfly 8.1.0 is using undertow version 1.0.15.Final, so the fix should be included.

When I switch transport mode tolong pooling, I don’t get any exception, but I get this in debug console "SEVERE: No active request " and “Session expired” message.

Am I missing something?

I recompile widgetset and and long-polling now work as expected.

I have furder investigated websocket issue and it seems that this is wildfly/undertow issue and has nothing to do with Vaadin or atmosphere.

Thanks for looking into this. I hope it gets fixed on the Wildfly side.

Here is link to the Wildfly issue
https://issues.jboss.org/browse/WFLY-3607