Session timeout doesn't work with websockets

Multi tool use
I've got a web application deployed on glassfish, where I have a timeout for session in web.xml:
<session-config>
<session-timeout>
1
</session-timeout>
</session-config>
It worked fine until I added WebSockets
Frontend:
var webSocket = new WebSocket('#{authenticationJSFBean.webSocketURL}');
webSocket.onmessage = function(message){
switch(message.data) {
case 'sendRegistrationRequest':
updateNewRegistrationRequestCount();
break;
case 'sendStageRequest':
updateSourceAndTargetParticipatingCompaniesDataTables();
break;
};
Backend:
@ServerEndpoint("/websocket/{login}")
public class WebSocketEndpoint {
private static final Set<Session> sessions = new CopyOnWriteArraySet<>();
private static final Logger LOG = LogManager.getLogger(WebSocketEndpoint.class);
@OnOpen
public void onOpen(@PathParam("login") String login, Session peer) {
sessions.add(peer);
}
@OnClose
public void onClose(Session peer) {
if(sessions.contains(peer)) {
sessions.remove(peer);
}
}
public static void sendMessage(String message) {
for(Session session : sessions) {
RemoteEndpoint.Basic endpoint = session.getBasicRemote();
try {
endpoint.sendText(message);
} catch(IOException ioe) {
LOG.warn("Unable to send message to sessionn Message:" + ioe.getMessage());
}
}
}
}
After I added this, session timeout stopped working. I tried to set timeout in websocket session:
peer.setMaxIdleTimeout(60 * 60 * 1000);
At first it looked like it helps, but on second or third session I've got an error:
[2018-12-27T10:01:30.833+0300] [glassfish 4.1] [WARNING] [org.glassfish.grizzly.filterchain.DefaultFilterChain] [tid: _ThreadID=120 _ThreadName=http-listener-1(1)] [timeMillis: 1545894090833] [levelValue: 900] [[
GRIZZLY0013: Exception during FilterChain execution
java.lang.NullPointerException
at org.glassfish.grizzly.attributes.Attribute.remove(Attribute.java:227)
at org.glassfish.grizzly.http.server.HttpServerFilter.afterService(HttpServerFilter.java:383)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:260)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:561)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545)
at java.lang.Thread.run(Thread.java:745)
]]
[2018-12-27T10:02:11.395+0300] [glassfish 4.1] [WARN] [org.jboss.weld.Servlet] [tid: _ThreadID=120 _ThreadName=http-listener-1(1)] [timeMillis: 1545894131395] [levelValue: 900] [[
WELD-000714: HttpContextLifecycle guard leak detected. The Servlet container is not fully compliant. The value was 1]]
[2018-12-27T10:02:11.396+0300] [glassfish 4.1] [WARNING] [javax.enterprise.web.core] [tid: _ThreadID=120 _ThreadName=http-listener-1(1)] [timeMillis: 1545894131396] [levelValue: 900] [[
Error invoking requestInitialized method on ServletRequestListener org.jboss.weld.servlet.WeldListener
java.lang.IllegalStateException: WELD-000335: Context is already active
at org.jboss.weld.context.http.LazyHttpConversationContextImpl.activate(LazyHttpConversationContextImpl.java:57)
at org.jboss.weld.servlet.ConversationContextActivator.activate(ConversationContextActivator.java:107)
at org.jboss.weld.servlet.ConversationContextActivator.activateConversationContext(ConversationContextActivator.java:93)
at org.jboss.weld.servlet.HttpContextLifecycle.requestInitialized(HttpContextLifecycle.java:225)
at org.jboss.weld.servlet.WeldInitialListener.requestInitialized(WeldInitialListener.java:156)
at org.apache.catalina.core.StandardContext.fireRequestInitializedEvent(StandardContext.java:5257)
at org.apache.catalina.core.StandardHostValve.preInvoke(StandardHostValve.java:655)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:166)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:415)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:282)
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:201)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:175)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:561)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545)
at java.lang.Thread.run(Thread.java:745)
]]
And timeout stops working again completly. How to fix it?
java session websocket glassfish
add a comment |
I've got a web application deployed on glassfish, where I have a timeout for session in web.xml:
<session-config>
<session-timeout>
1
</session-timeout>
</session-config>
It worked fine until I added WebSockets
Frontend:
var webSocket = new WebSocket('#{authenticationJSFBean.webSocketURL}');
webSocket.onmessage = function(message){
switch(message.data) {
case 'sendRegistrationRequest':
updateNewRegistrationRequestCount();
break;
case 'sendStageRequest':
updateSourceAndTargetParticipatingCompaniesDataTables();
break;
};
Backend:
@ServerEndpoint("/websocket/{login}")
public class WebSocketEndpoint {
private static final Set<Session> sessions = new CopyOnWriteArraySet<>();
private static final Logger LOG = LogManager.getLogger(WebSocketEndpoint.class);
@OnOpen
public void onOpen(@PathParam("login") String login, Session peer) {
sessions.add(peer);
}
@OnClose
public void onClose(Session peer) {
if(sessions.contains(peer)) {
sessions.remove(peer);
}
}
public static void sendMessage(String message) {
for(Session session : sessions) {
RemoteEndpoint.Basic endpoint = session.getBasicRemote();
try {
endpoint.sendText(message);
} catch(IOException ioe) {
LOG.warn("Unable to send message to sessionn Message:" + ioe.getMessage());
}
}
}
}
After I added this, session timeout stopped working. I tried to set timeout in websocket session:
peer.setMaxIdleTimeout(60 * 60 * 1000);
At first it looked like it helps, but on second or third session I've got an error:
[2018-12-27T10:01:30.833+0300] [glassfish 4.1] [WARNING] [org.glassfish.grizzly.filterchain.DefaultFilterChain] [tid: _ThreadID=120 _ThreadName=http-listener-1(1)] [timeMillis: 1545894090833] [levelValue: 900] [[
GRIZZLY0013: Exception during FilterChain execution
java.lang.NullPointerException
at org.glassfish.grizzly.attributes.Attribute.remove(Attribute.java:227)
at org.glassfish.grizzly.http.server.HttpServerFilter.afterService(HttpServerFilter.java:383)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:260)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:561)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545)
at java.lang.Thread.run(Thread.java:745)
]]
[2018-12-27T10:02:11.395+0300] [glassfish 4.1] [WARN] [org.jboss.weld.Servlet] [tid: _ThreadID=120 _ThreadName=http-listener-1(1)] [timeMillis: 1545894131395] [levelValue: 900] [[
WELD-000714: HttpContextLifecycle guard leak detected. The Servlet container is not fully compliant. The value was 1]]
[2018-12-27T10:02:11.396+0300] [glassfish 4.1] [WARNING] [javax.enterprise.web.core] [tid: _ThreadID=120 _ThreadName=http-listener-1(1)] [timeMillis: 1545894131396] [levelValue: 900] [[
Error invoking requestInitialized method on ServletRequestListener org.jboss.weld.servlet.WeldListener
java.lang.IllegalStateException: WELD-000335: Context is already active
at org.jboss.weld.context.http.LazyHttpConversationContextImpl.activate(LazyHttpConversationContextImpl.java:57)
at org.jboss.weld.servlet.ConversationContextActivator.activate(ConversationContextActivator.java:107)
at org.jboss.weld.servlet.ConversationContextActivator.activateConversationContext(ConversationContextActivator.java:93)
at org.jboss.weld.servlet.HttpContextLifecycle.requestInitialized(HttpContextLifecycle.java:225)
at org.jboss.weld.servlet.WeldInitialListener.requestInitialized(WeldInitialListener.java:156)
at org.apache.catalina.core.StandardContext.fireRequestInitializedEvent(StandardContext.java:5257)
at org.apache.catalina.core.StandardHostValve.preInvoke(StandardHostValve.java:655)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:166)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:415)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:282)
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:201)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:175)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:561)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545)
at java.lang.Thread.run(Thread.java:745)
]]
And timeout stops working again completly. How to fix it?
java session websocket glassfish
add a comment |
I've got a web application deployed on glassfish, where I have a timeout for session in web.xml:
<session-config>
<session-timeout>
1
</session-timeout>
</session-config>
It worked fine until I added WebSockets
Frontend:
var webSocket = new WebSocket('#{authenticationJSFBean.webSocketURL}');
webSocket.onmessage = function(message){
switch(message.data) {
case 'sendRegistrationRequest':
updateNewRegistrationRequestCount();
break;
case 'sendStageRequest':
updateSourceAndTargetParticipatingCompaniesDataTables();
break;
};
Backend:
@ServerEndpoint("/websocket/{login}")
public class WebSocketEndpoint {
private static final Set<Session> sessions = new CopyOnWriteArraySet<>();
private static final Logger LOG = LogManager.getLogger(WebSocketEndpoint.class);
@OnOpen
public void onOpen(@PathParam("login") String login, Session peer) {
sessions.add(peer);
}
@OnClose
public void onClose(Session peer) {
if(sessions.contains(peer)) {
sessions.remove(peer);
}
}
public static void sendMessage(String message) {
for(Session session : sessions) {
RemoteEndpoint.Basic endpoint = session.getBasicRemote();
try {
endpoint.sendText(message);
} catch(IOException ioe) {
LOG.warn("Unable to send message to sessionn Message:" + ioe.getMessage());
}
}
}
}
After I added this, session timeout stopped working. I tried to set timeout in websocket session:
peer.setMaxIdleTimeout(60 * 60 * 1000);
At first it looked like it helps, but on second or third session I've got an error:
[2018-12-27T10:01:30.833+0300] [glassfish 4.1] [WARNING] [org.glassfish.grizzly.filterchain.DefaultFilterChain] [tid: _ThreadID=120 _ThreadName=http-listener-1(1)] [timeMillis: 1545894090833] [levelValue: 900] [[
GRIZZLY0013: Exception during FilterChain execution
java.lang.NullPointerException
at org.glassfish.grizzly.attributes.Attribute.remove(Attribute.java:227)
at org.glassfish.grizzly.http.server.HttpServerFilter.afterService(HttpServerFilter.java:383)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:260)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:561)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545)
at java.lang.Thread.run(Thread.java:745)
]]
[2018-12-27T10:02:11.395+0300] [glassfish 4.1] [WARN] [org.jboss.weld.Servlet] [tid: _ThreadID=120 _ThreadName=http-listener-1(1)] [timeMillis: 1545894131395] [levelValue: 900] [[
WELD-000714: HttpContextLifecycle guard leak detected. The Servlet container is not fully compliant. The value was 1]]
[2018-12-27T10:02:11.396+0300] [glassfish 4.1] [WARNING] [javax.enterprise.web.core] [tid: _ThreadID=120 _ThreadName=http-listener-1(1)] [timeMillis: 1545894131396] [levelValue: 900] [[
Error invoking requestInitialized method on ServletRequestListener org.jboss.weld.servlet.WeldListener
java.lang.IllegalStateException: WELD-000335: Context is already active
at org.jboss.weld.context.http.LazyHttpConversationContextImpl.activate(LazyHttpConversationContextImpl.java:57)
at org.jboss.weld.servlet.ConversationContextActivator.activate(ConversationContextActivator.java:107)
at org.jboss.weld.servlet.ConversationContextActivator.activateConversationContext(ConversationContextActivator.java:93)
at org.jboss.weld.servlet.HttpContextLifecycle.requestInitialized(HttpContextLifecycle.java:225)
at org.jboss.weld.servlet.WeldInitialListener.requestInitialized(WeldInitialListener.java:156)
at org.apache.catalina.core.StandardContext.fireRequestInitializedEvent(StandardContext.java:5257)
at org.apache.catalina.core.StandardHostValve.preInvoke(StandardHostValve.java:655)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:166)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:415)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:282)
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:201)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:175)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:561)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545)
at java.lang.Thread.run(Thread.java:745)
]]
And timeout stops working again completly. How to fix it?
java session websocket glassfish
I've got a web application deployed on glassfish, where I have a timeout for session in web.xml:
<session-config>
<session-timeout>
1
</session-timeout>
</session-config>
It worked fine until I added WebSockets
Frontend:
var webSocket = new WebSocket('#{authenticationJSFBean.webSocketURL}');
webSocket.onmessage = function(message){
switch(message.data) {
case 'sendRegistrationRequest':
updateNewRegistrationRequestCount();
break;
case 'sendStageRequest':
updateSourceAndTargetParticipatingCompaniesDataTables();
break;
};
Backend:
@ServerEndpoint("/websocket/{login}")
public class WebSocketEndpoint {
private static final Set<Session> sessions = new CopyOnWriteArraySet<>();
private static final Logger LOG = LogManager.getLogger(WebSocketEndpoint.class);
@OnOpen
public void onOpen(@PathParam("login") String login, Session peer) {
sessions.add(peer);
}
@OnClose
public void onClose(Session peer) {
if(sessions.contains(peer)) {
sessions.remove(peer);
}
}
public static void sendMessage(String message) {
for(Session session : sessions) {
RemoteEndpoint.Basic endpoint = session.getBasicRemote();
try {
endpoint.sendText(message);
} catch(IOException ioe) {
LOG.warn("Unable to send message to sessionn Message:" + ioe.getMessage());
}
}
}
}
After I added this, session timeout stopped working. I tried to set timeout in websocket session:
peer.setMaxIdleTimeout(60 * 60 * 1000);
At first it looked like it helps, but on second or third session I've got an error:
[2018-12-27T10:01:30.833+0300] [glassfish 4.1] [WARNING] [org.glassfish.grizzly.filterchain.DefaultFilterChain] [tid: _ThreadID=120 _ThreadName=http-listener-1(1)] [timeMillis: 1545894090833] [levelValue: 900] [[
GRIZZLY0013: Exception during FilterChain execution
java.lang.NullPointerException
at org.glassfish.grizzly.attributes.Attribute.remove(Attribute.java:227)
at org.glassfish.grizzly.http.server.HttpServerFilter.afterService(HttpServerFilter.java:383)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:260)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:561)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545)
at java.lang.Thread.run(Thread.java:745)
]]
[2018-12-27T10:02:11.395+0300] [glassfish 4.1] [WARN] [org.jboss.weld.Servlet] [tid: _ThreadID=120 _ThreadName=http-listener-1(1)] [timeMillis: 1545894131395] [levelValue: 900] [[
WELD-000714: HttpContextLifecycle guard leak detected. The Servlet container is not fully compliant. The value was 1]]
[2018-12-27T10:02:11.396+0300] [glassfish 4.1] [WARNING] [javax.enterprise.web.core] [tid: _ThreadID=120 _ThreadName=http-listener-1(1)] [timeMillis: 1545894131396] [levelValue: 900] [[
Error invoking requestInitialized method on ServletRequestListener org.jboss.weld.servlet.WeldListener
java.lang.IllegalStateException: WELD-000335: Context is already active
at org.jboss.weld.context.http.LazyHttpConversationContextImpl.activate(LazyHttpConversationContextImpl.java:57)
at org.jboss.weld.servlet.ConversationContextActivator.activate(ConversationContextActivator.java:107)
at org.jboss.weld.servlet.ConversationContextActivator.activateConversationContext(ConversationContextActivator.java:93)
at org.jboss.weld.servlet.HttpContextLifecycle.requestInitialized(HttpContextLifecycle.java:225)
at org.jboss.weld.servlet.WeldInitialListener.requestInitialized(WeldInitialListener.java:156)
at org.apache.catalina.core.StandardContext.fireRequestInitializedEvent(StandardContext.java:5257)
at org.apache.catalina.core.StandardHostValve.preInvoke(StandardHostValve.java:655)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:166)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:415)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:282)
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:201)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:175)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:561)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545)
at java.lang.Thread.run(Thread.java:745)
]]
And timeout stops working again completly. How to fix it?
java session websocket glassfish
java session websocket glassfish
asked 6 hours ago
Simatsu Edgeworth
2610
2610
add a comment |
add a comment |
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53941966%2fsession-timeout-doesnt-work-with-websockets%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53941966%2fsession-timeout-doesnt-work-with-websockets%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
mxhK6Gxdd BO mAYN3,NLx1fynz o V0njzKMbEAtHkIloVAMdQCL H r8,Iu9Ug,yJXOIxVwRRbfBldkwRdI4ei