关于参数cuba.web.pushEnabled配置的问题

我们是用wildfly为中间件时,当登录某些需要加载大量用户角色权限数据时,大约10s多(普通用户无问题),会出现黑色通讯异常错误提示,后来感觉有可能是webSocket的原因,尝试配置cuba.web.pushEnabled为false,结果肯定的,可以正常登录了,但是出现一个新的问题那就是登录超时的机制失效了,默认1800秒后还能正常使用,所以现在有两点疑问麻烦请解答下。
一、cuba.web.pushEnabled这个参数官方解释是服务推送,请问他具体影响什么功能?和用户会话超时的时限有什么关系?
二、如果我们将cuba.web.pushEnabled设置为true是,启用websock后,应该设置中间件的那些参数去支持应用?我们对websocket这块基本不懂
这个问题困扰我们很久了!谢谢大佬!谢谢大佬!谢谢大佬!
1
2

cuba.web.pushEnabled 这个参数控制是否开启服务端推送,即服务端有数据更新需要发往 UI 时采用从服务端向 UI 推送的模式。如果这个参数关闭之后,只有在 UI 层发起 request 的时候,才会从服务端拿到新的数据。服务端推送的数据交互模式,是使用 Websocket 通信的典型模式。

这个参数是从 Vaadin 继承而来,即用来控制后台任务与 UI 的通信机制。因此:

  1. 如果这个参数关闭,那么后台的数据不会及时发送给 UI。而是需要等到前端伺机刷新。
  2. 对 wildfly 的配置需要参考官方文档,你们用的哪个版本?
  3. 如果怀疑是 Websocket 的问题,可以试试设置 cuba.web.pushLongPolling 为 true,将 websocket 连接换成长轮询,并将轮询的超时设置长一些,比如 15 分钟。
  4. 在出现通讯问题时,log 中是否有关于 Websocket 连接中断的日志信息?
  5. 关于 pushEnabled 参数,中文文档有误,应为:可以完全禁用服务器推送,此时后台任务机制将不可用 如果你们用到了后台任务,则关闭此参数会影响后台任务。

我把配置改成cuba.web.pushLongPolling = true 报下面错误,Session is invalid

2021-03-22 09:40:59,750 ERROR [io.undertow.servlet.request] (default task-6) UT015005: Error invoking method requestInitialized on listener class org.jboss.weld.module.web.servlet.WeldInitialListener: java.lang.IllegalStateException: UT000010: Session is invalid N_2C6r0dqrdqwhbOF-xXxoC2QP4p57tmMTm-8QcE
	at io.undertow.server.session.InMemorySessionManager$SessionImpl.getAttribute(InMemorySessionManager.java:512)
	at io.undertow.servlet.spec.HttpSessionImpl.getAttribute(HttpSessionImpl.java:122)
	at org.jboss.weld.module.web.context.http.HttpSessionContextImpl.checkBeanIdentifierIndexConsistency(HttpSessionContextImpl.java:100)
	at org.jboss.weld.module.web.context.http.HttpSessionContextImpl.associate(HttpSessionContextImpl.java:49)
	at org.jboss.weld.module.web.context.http.HttpSessionContextImpl.associate(HttpSessionContextImpl.java:25)
	at org.jboss.weld.module.web.servlet.HttpContextLifecycle.requestInitialized(HttpContextLifecycle.java:244)
	at org.jboss.weld.module.web.servlet.WeldInitialListener.requestInitialized(WeldInitialListener.java:152)
	at io.undertow.servlet.core.ApplicationListeners.requestInitialized(ApplicationListeners.java:248)
	at io.undertow.servlet.spec.AsyncContextImpl.setupRequestContext(AsyncContextImpl.java:712)
	at io.undertow.servlet.spec.AsyncContextImpl.access$700(AsyncContextImpl.java:73)
	at io.undertow.servlet.spec.AsyncContextImpl$7.run(AsyncContextImpl.java:625)
	at io.undertow.servlet.spec.ServletContextImpl$2.call(ServletContextImpl.java:181)
	at io.undertow.servlet.spec.ServletContextImpl$2.call(ServletContextImpl.java:178)
	at io.undertow.servlet.spec.ServletContextImpl.invokeRunnable(ServletContextImpl.java:1032)
	at io.undertow.servlet.spec.AsyncContextImpl.onAsyncComplete(AsyncContextImpl.java:620)
	at io.undertow.servlet.spec.AsyncContextImpl.onAsyncCompleteAndRespond(AsyncContextImpl.java:594)
	at io.undertow.servlet.spec.AsyncContextImpl.access$100(AsyncContextImpl.java:73)
	at io.undertow.servlet.spec.AsyncContextImpl$3.run(AsyncContextImpl.java:306)
	at io.undertow.servlet.spec.AsyncContextImpl$6.run(AsyncContextImpl.java:465)
	at io.undertow.servlet.spec.AsyncContextImpl$TaskDispatchRunnable.run(AsyncContextImpl.java:584)
	at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
	at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1982)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
	at java.lang.Thread.run(Thread.java:748)

2021-03-22 09:40:59,751 WARN  [org.jboss.weld.Servlet] (default task-6) WELD-000717: Unable to deactivate context org.jboss.weld.module.web.context.http.HttpSessionContextImpl@3edb990b when destroying request AtmosphereRequest{ method=GET contextPath=/ajyth servletPath= pathInfo=/PUSH requestURI=/ajyth/PUSH requestURL=http://192.168.100.12:8080/ajyth/PUSH AtmosphereResource UUID=375e92ad-e78a-49cb-8fa0-86fac2c36871 destroyable=true}
2021-03-22 09:40:59,751 ERROR [io.undertow.servlet.request] (default task-6) UT015021: Failure dispatching async event: java.lang.RuntimeException: java.lang.IllegalStateException: UT000010: Session is invalid N_2C6r0dqrdqwhbOF-xXxoC2QP4p57tmMTm-8QcE
	at io.undertow.servlet.spec.ServletContextImpl.invokeRunnable(ServletContextImpl.java:1034)
	at io.undertow.servlet.spec.AsyncContextImpl.onAsyncComplete(AsyncContextImpl.java:620)
	at io.undertow.servlet.spec.AsyncContextImpl.onAsyncCompleteAndRespond(AsyncContextImpl.java:594)
	at io.undertow.servlet.spec.AsyncContextImpl.access$100(AsyncContextImpl.java:73)
	at io.undertow.servlet.spec.AsyncContextImpl$3.run(AsyncContextImpl.java:306)
	at io.undertow.servlet.spec.AsyncContextImpl$6.run(AsyncContextImpl.java:465)
	at io.undertow.servlet.spec.AsyncContextImpl$TaskDispatchRunnable.run(AsyncContextImpl.java:584)
	at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
	at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1982)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalStateException: UT000010: Session is invalid N_2C6r0dqrdqwhbOF-xXxoC2QP4p57tmMTm-8QcE
	at io.undertow.server.session.InMemorySessionManager$SessionImpl.getAttribute(InMemorySessionManager.java:512)
	at io.undertow.servlet.spec.HttpSessionImpl.getAttribute(HttpSessionImpl.java:122)
	at org.jboss.weld.module.web.context.http.HttpSessionContextImpl.checkBeanIdentifierIndexConsistency(HttpSessionContextImpl.java:100)
	at org.jboss.weld.module.web.context.http.HttpSessionContextImpl.associate(HttpSessionContextImpl.java:49)
	at org.jboss.weld.module.web.context.http.HttpSessionContextImpl.associate(HttpSessionContextImpl.java:25)
	at org.jboss.weld.module.web.servlet.HttpContextLifecycle.requestInitialized(HttpContextLifecycle.java:244)
	at org.jboss.weld.module.web.servlet.WeldInitialListener.requestInitialized(WeldInitialListener.java:152)
	at io.undertow.servlet.core.ApplicationListeners.requestInitialized(ApplicationListeners.java:248)
	at io.undertow.servlet.spec.AsyncContextImpl.setupRequestContext(AsyncContextImpl.java:712)
	at io.undertow.servlet.spec.AsyncContextImpl.access$700(AsyncContextImpl.java:73)
	at io.undertow.servlet.spec.AsyncContextImpl$7.run(AsyncContextImpl.java:625)
	at io.undertow.servlet.spec.ServletContextImpl$2.call(ServletContextImpl.java:181)
	at io.undertow.servlet.spec.ServletContextImpl$2.call(ServletContextImpl.java:178)
	at io.undertow.servlet.spec.ServletContextImpl.invokeRunnable(ServletContextImpl.java:1032)
	... 11 more