vaadin:有时/经常我得到 java.util.concurrent.TimeoutException: null before session get destroyed when push is used

vaadin: sometimes / often I get java.util.concurrent.TimeoutException: null before session get destroyed when Push is used

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

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

我post完整的堆栈跟踪:

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$nulld65655(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$fireSessionDestroyc853e43(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.access1(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 可能会以更好的方式处理这种情况,以避免抛出可能导致其他清理无法进行的异常 运行。