vaadin / kubernetes-kit

Other
3 stars 3 forks source link

NotifyPushConnection seldom throws exception on server shutdown #133

Open mcollovati opened 6 months ago

mcollovati commented 6 months ago

When the server is stopped, an exception may be thrown when NotifyPushConnection gets PushSendListener beans from Spring.

java.util.concurrent.ExecutionException: java.lang.RuntimeException: Push failed
    at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[na:na]
    at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191) ~[na:na]
    at com.vaadin.flow.server.FutureAccess.get(FutureAccess.java:62) ~[flow-server-24.4-20240417.094018-396.jar:24.4-SNAPSHOT]
    at com.vaadin.flow.server.VaadinService.runPendingAccessTasks(VaadinService.java:2088) ~[flow-server-24.4-20240417.094018-396.jar:24.4-SNAPSHOT]
    at com.vaadin.flow.server.VaadinSession.unlock(VaadinSession.java:725) ~[flow-server-24.4-20240417.094018-396.jar:24.4-SNAPSHOT]
    at com.vaadin.flow.server.VaadinService.ensureAccessQueuePurged(VaadinService.java:2050) ~[flow-server-24.4-20240417.094018-396.jar:24.4-SNAPSHOT]
    at com.vaadin.flow.server.VaadinService.accessSession(VaadinService.java:2017) ~[flow-server-24.4-20240417.094018-396.jar:24.4-SNAPSHOT]
    at com.vaadin.flow.server.VaadinSession.access(VaadinSession.java:1029) ~[flow-server-24.4-20240417.094018-396.jar:24.4-SNAPSHOT]
    at com.vaadin.flow.server.VaadinService.fireSessionDestroy(VaadinService.java:627) ~[flow-server-24.4-20240417.094018-396.jar:24.4-SNAPSHOT]
    at com.vaadin.flow.server.VaadinSession.valueUnbound(VaadinSession.java:208) ~[flow-server-24.4-20240417.094018-396.jar:24.4-SNAPSHOT]
    at org.apache.catalina.session.StandardSession.removeAttributeInternal(StandardSession.java:1649) ~[tomcat-embed-core-10.1.19.jar:10.1.19]
    at org.apache.catalina.session.StandardSession.expire(StandardSession.java:803) ~[tomcat-embed-core-10.1.19.jar:10.1.19]
    at org.apache.catalina.session.StandardSession.expire(StandardSession.java:695) ~[tomcat-embed-core-10.1.19.jar:10.1.19]
    at org.apache.catalina.session.StandardManager.stopInternal(StandardManager.java:385) ~[tomcat-embed-core-10.1.19.jar:10.1.19]
    at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:242) ~[tomcat-embed-core-10.1.19.jar:10.1.19]
    at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5105) ~[tomcat-embed-core-10.1.19.jar:10.1.19]
    at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:242) ~[tomcat-embed-core-10.1.19.jar:10.1.19]
    at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1348) ~[tomcat-embed-core-10.1.19.jar:10.1.19]
    at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1337) ~[tomcat-embed-core-10.1.19.jar:10.1.19]
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[na:na]
    at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) ~[tomcat-embed-core-10.1.19.jar:10.1.19]
    at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145) ~[na:na]
    at org.apache.catalina.core.ContainerBase.stopInternal(ContainerBase.java:931) ~[tomcat-embed-core-10.1.19.jar:10.1.19]
    at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:242) ~[tomcat-embed-core-10.1.19.jar:10.1.19]
    at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1348) ~[tomcat-embed-core-10.1.19.jar:10.1.19]
    at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1337) ~[tomcat-embed-core-10.1.19.jar:10.1.19]
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[na:na]
    at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) ~[tomcat-embed-core-10.1.19.jar:10.1.19]
    at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145) ~[na:na]
    at org.apache.catalina.core.ContainerBase.stopInternal(ContainerBase.java:931) ~[tomcat-embed-core-10.1.19.jar:10.1.19]
    at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:242) ~[tomcat-embed-core-10.1.19.jar:10.1.19]
    at org.apache.catalina.core.StandardService.stopInternal(StandardService.java:496) ~[tomcat-embed-core-10.1.19.jar:10.1.19]
    at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:242) ~[tomcat-embed-core-10.1.19.jar:10.1.19]
    at org.apache.catalina.core.StandardServer.stopInternal(StandardServer.java:974) ~[tomcat-embed-core-10.1.19.jar:10.1.19]
    at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:242) ~[tomcat-embed-core-10.1.19.jar:10.1.19]
    at org.apache.catalina.startup.Tomcat.stop(Tomcat.java:447) ~[tomcat-embed-core-10.1.19.jar:10.1.19]
    at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.stopTomcat(TomcatWebServer.java:297) ~[spring-boot-3.2.4.jar:3.2.4]
    at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.destroy(TomcatWebServer.java:370) ~[spring-boot-3.2.4.jar:3.2.4]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.doClose(ServletWebServerApplicationContext.java:177) ~[spring-boot-3.2.4.jar:3.2.4]
    at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:1093) ~[spring-context-6.1.5.jar:6.1.5]
    at org.springframework.boot.SpringApplicationShutdownHook.closeAndWait(SpringApplicationShutdownHook.java:145) ~[spring-boot-3.2.4.jar:3.2.4]
    at java.base/java.lang.Iterable.forEach(Iterable.java:75) ~[na:na]
    at org.springframework.boot.SpringApplicationShutdownHook.run(SpringApplicationShutdownHook.java:114) ~[spring-boot-3.2.4.jar:3.2.4]
    at java.base/java.lang.Thread.run(Thread.java:833) ~[na:na]
Caused by: java.lang.RuntimeException: Push failed
    at com.vaadin.flow.server.communication.AtmospherePushConnection.push(AtmospherePushConnection.java:211) ~[flow-server-24.4-20240417.094018-396.jar:24.4-SNAPSHOT]
    at com.vaadin.flow.server.communication.AtmospherePushConnection.push(AtmospherePushConnection.java:181) ~[flow-server-24.4-20240417.094018-396.jar:24.4-SNAPSHOT]
    at com.vaadin.flow.component.UI.close(UI.java:373) ~[flow-server-24.4-20240417.094018-396.jar:24.4-SNAPSHOT]
    at com.vaadin.flow.server.VaadinService.lambda$fireSessionDestroy$20ed7015$1(VaadinService.java:644) ~[flow-server-24.4-20240417.094018-396.jar:24.4-SNAPSHOT]
    at com.vaadin.flow.component.UI.accessSynchronously(UI.java:496) ~[flow-server-24.4-20240417.094018-396.jar:24.4-SNAPSHOT]
    at com.vaadin.flow.component.UI.accessSynchronously(UI.java:457) ~[flow-server-24.4-20240417.094018-396.jar:24.4-SNAPSHOT]
    at com.vaadin.flow.server.VaadinService.lambda$fireSessionDestroy$9c853e43$1(VaadinService.java:636) ~[flow-server-24.4-20240417.094018-396.jar:24.4-SNAPSHOT]
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[na:na]
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[na:na]
    at com.vaadin.flow.server.VaadinService.runPendingAccessTasks(VaadinService.java:2085) ~[flow-server-24.4-20240417.094018-396.jar:24.4-SNAPSHOT]
    ... 40 common frames omitted
Caused by: java.lang.IllegalStateException: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@128d1ddb has been closed already
    at org.springframework.context.support.AbstractApplicationContext.assertBeanFactoryActive(AbstractApplicationContext.java:1218) ~[spring-context-6.1.5.jar:6.1.5]
    at org.springframework.context.support.AbstractApplicationContext.getBeansOfType(AbstractApplicationContext.java:1379) ~[spring-context-6.1.5.jar:6.1.5]
    at com.vaadin.flow.spring.SpringLookupInitializer$SpringLookup.lookupAll(SpringLookupInitializer.java:140) ~[vaadin-spring-24.4-20240417.094018-396.jar:na]
    at com.vaadin.kubernetes.starter.sessiontracker.push.NotifyingPushConnection.sendMessage(NotifyingPushConnection.java:49) ~[classes/:na]
    at com.vaadin.flow.server.communication.AtmospherePushConnection.push(AtmospherePushConnection.java:209) ~[flow-server-24.4-20240417.094018-396.jar:24.4-SNAPSHOT]
    ... 49 common frames omitted