微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

vaadin: 有时/经常我得到 java.util.concurrent.TimeoutException: null before session 在使用 Push 时被破坏

如何解决vaadin: 有时/经常我得到 java.util.concurrent.TimeoutException: null before session 在使用 Push 时被破坏

在 Vaadin 流程 14 上,在会话被销毁之前使用 Push 时,有时会碰巧得到 java.util.concurrent.TimeoutException: null

这正常吗?我可以忽略这个异常吗?

我发布了完整的堆栈跟踪:

2021-07-31 16:12:49,957 [Scheduler-1277181601-1] INFO  c.v.f.s.c.AtmospherePushConnection - Timeout waiting for messages to be sent to client before disconnect
java.util.concurrent.TimeoutException: null
        at org.atmosphere.cpr.broadcasterFuture.get(broadcasterFuture.java:126)
        at com.vaadin.flow.server.communication.AtmospherePushConnection.disconnect(AtmospherePushConnection.java:329)
        at com.vaadin.flow.component.internal.UIInternals.setPushConnection(UIInternals.java:449)
        at com.vaadin.flow.component.internal.UIInternals.setSession(UIInternals.java:401)
        at com.vaadin.flow.server.VaadinSession.removeUI(VaadinSession.java:575)
        at com.vaadin.flow.server.VaadinService.lambda$null$65d65655$1(VaadinService.java:663)
        at com.vaadin.flow.component.UI.accessSynchronously(UI.java:431)
        at com.vaadin.flow.component.UI.accessSynchronously(UI.java:392)
        at com.vaadin.flow.server.VaadinService.lambda$fireSessionDestroy$9c853e43$1(VaadinService.java:653)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at com.vaadin.flow.server.VaadinService.runPendingAccesstasks(VaadinService.java:2039)
        at com.vaadin.flow.server.VaadinSession.unlock(VaadinSession.java:663)
        at com.vaadin.flow.server.VaadinService.ensureAccessQueuePurged(VaadinService.java:2005)
        at com.vaadin.flow.server.VaadinService.accessSession(VaadinService.java:1972)
        at com.vaadin.flow.server.VaadinSession.access(VaadinSession.java:951)
        at com.vaadin.flow.server.VaadinService.fireSessionDestroy(VaadinService.java:644)
        at com.vaadin.flow.server.VaadinSession.valueUnbound(VaadinSession.java:191)
        at org.eclipse.jetty.server.session.Session.unbindValue(Session.java:361)
        at org.eclipse.jetty.server.session.Session.callSessionAttributeListeners(Session.java:339)
        at org.eclipse.jetty.server.session.Session.finishInvalidate(Session.java:1072)
        at org.eclipse.jetty.server.session.SessionHandler.invalidate(SessionHandler.java:1220)
        at org.eclipse.jetty.server.session.DefaultSessionIdManager.expireAll(DefaultSessionIdManager.java:436)
        at org.eclipse.jetty.server.session.SessionHandler.scavenge(SessionHandler.java:1264)
        at org.eclipse.jetty.server.session.HouseKeeper.scavenge(HouseKeeper.java:257)
        at org.eclipse.jetty.server.session.HouseKeeper$Runner.run(HouseKeeper.java:61)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)

在这个会话被销毁之后:

2021-07-31 16:12:49,962 [Scheduler-1277181601-1] DEBUG t.a.SessionLogger - session destroyed,id: node01k3qkglhhptjbvu1izf5wd1da60

解决方法

如果我正确理解情况,这个例外是无害的。我假设用户已从网络中掉线或以其他方式无法访问,而这种方式以前并未触发明确检测到的推送连接终止。 Vaadin 在会话过期时向客户端发送最后一条消息,但发送此消息会导致连接超时。

这种情况可能会从 Vaadin 以更好的方式处理,以避免抛出可能导致其他清理无法运行的异常。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。