Example
@Route("")
@Theme(Lumo.class)
public class DemoView extends VerticalLayout {
public DemoView() {
getElement().addEventListener("click", e -> {
throw new Error("Fail");
});
}
Clicking on the button logs two exceptions
[WARNING] Error for /
java.lang.Error: Fail
at DemoView.lambda$0(DemoView.java:14)
at com.vaadin.flow.internal.nodefeature.ElementListenerMap.lambda$fireEvent$0(ElementListenerMap.java:171)
at java.util.ArrayList.forEach(ArrayList.java:1249)
at com.vaadin.flow.internal.nodefeature.ElementListenerMap.fireEvent(ElementListenerMap.java:171)
at com.vaadin.flow.server.communication.rpc.EventRpcHandler.handleNode(EventRpcHandler.java:58)
at com.vaadin.flow.server.communication.rpc.AbstractRpcInvocationHandler.handle(AbstractRpcInvocationHandler.java:60)
at com.vaadin.flow.server.communication.ServerRpcHandler.handleInvocationData(ServerRpcHandler.java:377)
at com.vaadin.flow.server.communication.ServerRpcHandler.lambda$handleInvocations$0(ServerRpcHandler.java:367)
at java.util.ArrayList.forEach(ArrayList.java:1249)
at com.vaadin.flow.server.communication.ServerRpcHandler.handleInvocations(ServerRpcHandler.java:367)
at com.vaadin.flow.server.communication.ServerRpcHandler.handleRpc(ServerRpcHandler.java:309)
at com.vaadin.flow.server.communication.UidlRequestHandler.synchronizedHandleRequest(UidlRequestHandler.java:89)
at com.vaadin.flow.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:40)
at com.vaadin.flow.server.VaadinService.handleRequest(VaadinService.java:1541)
at com.vaadin.flow.server.VaadinServlet.service(VaadinServlet.java:345)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
which is expected but then the client side gets a 500 back. The client side then tries to re-send the message as it does not know if the message ever reached the server. This will cause another exception to be logged
[qtp1532675992-33] ERROR com.vaadin.flow.server.DefaultErrorHandler -
java.lang.UnsupportedOperationException: Confirmed duplicate message from the client. Expected sync id: 1, got 0. Message start: {"csrfToken":"ab0f5d03-ba71-408a-8e60-9bfc09b8df65","rpc":[{"type":"event","node":3,"event":"click"}],"syncId":0,"clientId":0}
at com.vaadin.flow.server.communication.ServerRpcHandler.handleRpc(ServerRpcHandler.java:302)
at com.vaadin.flow.server.communication.UidlRequestHandler.synchronizedHandleRequest(UidlRequestHandler.java:89)
at com.vaadin.flow.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:40)
at com.vaadin.flow.server.VaadinService.handleRequest(VaadinService.java:1541)
at com.vaadin.flow.server.VaadinServlet.service(VaadinServlet.java:345)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:835)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1685)
at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:225)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1668)
In FW8, this case is handled as
ui.getSession().getCommunicationManager().repaintAll(ui);
if (rpcRequest.getClientToServerId() < expectedId) {
// Just a duplicate message due to a bad connection or similar
// It has already been handled by the server so it is safe to
// ignore
getLogger()
.fine("Ignoring old message from the client. Expected: "
+ expectedId + ", got: "
+ rpcRequest.getClientToServerId());
which seems more appropriate.
In real world, this happened during development when part of the code was not redeployed and caused a java.lang.NoSuchMethodError to be thrown
I'm wondering whether this should instead be handled in a way that avoids returning a 500 to the client? There isn't really any point in having the client send a new request in this kind of situation.
do we have any updated on this issue?
I am facing same issue for vaadin 10.
Getting "confirmed duplicate message" almost daily. Currently on 13.0.4.
2019-04-23 18:18:33.098 WARN 18342 --- [nio-8080-exec-6] c.v.f.s.c.r.AbstractRpcInvocationHandler : Got an RPC for non-existent node: 447
2019-04-23 18:18:33.139 ERROR 18342 --- [nio-8080-exec-3] c.v.flow.server.DefaultErrorHandler :
java.lang.UnsupportedOperationException: Confirmed duplicate message from the client. Expected sync id: 23, got 22. Message start: {"csrfToken":"793e0f18-f890-4fb5-9e13-17a9438efe75","rpc":[{"type":"publishedEventHandler","node":447,"templateEventMethodName":"select","templateEventMethodArgs":["4"]},{"type":"publishedEventHandler","node":447,"templateEventMethodName":"setDetailsVisible","templateEventMethodArgs":["4"]}],"syncId":22,"clientId":22}
at com.vaadin.flow.server.communication.ServerRpcHandler.handleRpc(ServerRpcHandler.java:303) ~[flow-server-1.4.3.jar:1.4.3]
at com.vaadin.flow.server.communication.UidlRequestHandler.synchronizedHandleRequest(UidlRequestHandler.java:89) ~[flow-server-1.4.3.jar:1.4.3]
at com.vaadin.flow.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:40) ~[flow-server-1.4.3.jar:1.4.3]
at com.vaadin.flow.server.VaadinService.handleRequest(VaadinService.java:1507) ~[flow-server-1.4.3.jar:1.4.3]
at com.vaadin.flow.server.VaadinServlet.service(VaadinServlet.java:242) [flow-server-1.4.3.jar:1.4.3]
at com.vaadin.flow.spring.SpringServlet.service(SpringServlet.java:81) [vaadin-spring-11.0.0.jar:na]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [javax.servlet-api-3.1.0.jar:3.1.0]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) [tomcat-embed-core-8.5.31.jar:8.5.31]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.31.jar:8.5.31]
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:728) [tomcat-embed-core-8.5.31.jar:8.5.31]
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:470) [tomcat-embed-core-8.5.31.jar:8.5.31]
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:356) [tomcat-embed-core-8.5.31.jar:8.5.31]
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:316) [tomcat-embed-core-8.5.31.jar:8.5.31]
at org.springframework.web.servlet.mvc.ServletForwardingController.handleRequestInternal(ServletForwardingController.java:141) [spring-webmvc-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:177) [spring-webmvc-5.0.6.RELEASE.jar:5.0.6.RELEASE]
@uttamkasundra, @martinisraelsen Any ideas on how to reproduce this in any other way than the originally reported case of throw new Error("Fail");?
@Legioth
I see it mostly when 1) it's deployed to the test server (running in production mode) and 2) when I click somewhat rapidly between views. It happen today during a demo and afterwards I tried to provoke it and eventually I got it to happen again after clicking back and forth between views many times.
In the browser I got
[Error] Failed to load resource: The network connection was lost. (bcx, line 0)
http://xx.xx.xxx.xxx:8080/bcx/?v-r=uidl&v-uiId=9
and on the server
java.lang.UnsupportedOperationException: Confirmed duplicate message from the client. Expected sync id: 186, got 185. Message start: {"csrfToken":"a2e0045e-c2e8-413d-9a74-0bc555d62579","rpc":[{"type":"mSync","node":2767,"feature":1,"property":"filter","value":""},{"type":"mSync","node":2767,"feature":1,"property":"opened","value":false},{"type":"mSync","node":2763,"feature":1,"property":"filter","value":""},{"type":"mSync","node":2763,"feature":1,"property":"opened","value":false},{"type":"event","node":2824,"event":"opened-changed"}],"syncId":185,"clientId":185}
at com.vaadin.flow.server.communication.ServerRpcHandler.handleRpc(ServerRpcHandler.java:303) ~[flow-server-1.4.3.jar:1.4.3]
at com.vaadin.flow.server.communication.UidlRequestHandler.synchronizedHandleRequest(UidlRequestHandler.java:89) ~[flow-server-1.4.3.jar:1.4.3]
at com.vaadin.flow.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:40) ~[flow-server-1.4.3.jar:1.4.3]
at com.vaadin.flow.server.VaadinService.handleRequest(VaadinService.java:1507) ~[flow-server-1.4.3.jar:1.4.3]
at com.vaadin.flow.server.VaadinServlet.service(VaadinServlet.java:242) [flow-server-1.4.3.jar:1.4.3]
at com.vaadin.flow.spring.SpringServlet.service(SpringServlet.java:81) [vaadin-spring-11.0.0.jar:na]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:742) [servlet-api.jar:na]
Perhaps related, I saw a few other errors related to images.
One page shows 10 different images and they are being served somewhat slowly because the server is resizing them on the fly. In this case two of them didn't load and the following message was in the browser console.
Failed to load resource: Cancelled load from 'http://xx.xx.xx.xxx:8080/bcx/m/images/37f58f04-06d9-4d7f-842b-dca148480c67/chicago.jpg' because it is using HTTP/0.9.
It could seem that the underlying issue that I experienced is because of the dropped network connection. It might be specific to Safari or Tomcat, I have not tested with Chrome or Firefox. The test server is small/slow specifically to help identify issues related to slow connections.
Even if this scenario can be solved with a faster server / different tomcat settings etc, I still think that it would be beneficial to change the error to a log warning as @Artur- suggested.
An update on this - I've seen it quite a lot even locally the last couple of days. Also on pages without images.
java.lang.UnsupportedOperationException: Confirmed duplicate message from the client. Expected sync id: 7, got 6. Message start: {"csrfToken":"236efe72-3bdf-456e-80b8-a4019809bece","rpc":[{"type":"event","node":191,"event":"click","data":{"event.shiftKey":false,"event.metaKey":false,"event.detail":1,"event.ctrlKey":false,"event.clientX":1065,"event.clientY":25,"event.altKey":false,"event.button":0,"event.screenY":324,"event.screenX":1124}}],"syncId":6,"clientId":6}
For me,
It is working fine after correcting relationships and adding appropriate equals, hashcode and tostring methods of entity, As well as added @JsonManagedReference and @JsonBackReference for bidirectional JPA relation ship.
Wanted to send an update on this as I continue to see this error as well as errors related to images not always being sent to the client.
I've been able to reproduce the errors with both Safari and Chrome. In both cases, I see network errors, both when loading locally and loading from a remote test server. Using stand-alone Tomcat 8.5 for remote server and spring-boot embedded Tomcat 9 locally. Because of the different versions, I suspect that Tomcat is not the issue.
In Safari, I get messages indicating that the resource could not be loaded because it was using HTTP/0.9. In Chrome I get net::ERR_INVALID_HTTP_RESPONSE. These error messages for images and for loading webcomponents.js. These errors may or may not be related to the duplicate message error.


For the duplicate message error, I managed to capture the duplicate error with wireshark. Attached are screenshots of the 5 packages. The original request is in package 1. There are then 2 responses from the server in package 2 + 3. Client resends package in package 4 and then server sends the internal error (caused by duplicate package) in package 5. Package 2 + 3 looks similar except for a few bytes that are different and the sync ids are missing.
Packet 1:

Packet 2:

Packet 3:

Packet 4:

Packet 5:

Also encountering this problem now post an upgrade.
Confirmed duplicate message from the client. Expected sync id: 5, got 4. Message start: {"csrfToken":"050b6d3f-2b3e-4e77-a596-a277cdf5fd23","rpc":[{"type":"event","node":31,"event":"upload-error","data":{"event.detail":{"file":{"loaded":5857310,"held":false,"status":"","xhr":{},"uploadTarget":"VAADIN/dynamic/resource/0/78018062-4edf-45f2-979a-80d0f2169b82/upload","formDataName":"file","indeterminate":false,"uploading":false,"error":"Unexpected Server Error","abort":false,"complete":false,"progress":100,"elapsed":0.401,"elapsedStr":"00:00:00.401","remaining":1,"remainingStr":"00:00:01","speed":14264,"totalStr":"5.9 MB","loadedStr":"5.9 MB"},"xhr":{}},"event.detail.xhr":{},"event.detail.file":{"loaded":5857310,"held":false,"status":"","xhr":{},"uploadTarget":"VAADIN/dynamic/resource/0/78018062-4edf-45f2-979a-80d0f2169b82/upload","formDataName":"file","indeterminate":false,"uploading":false,"error":"Unexpected Server Error","abort":false,"complete":false,"progress":100,"elapsed":0.401,"elapsedStr":"00:00:00.401","remaining":1,"remainingStr":"00:00:01","speed":14264,"totalStr
I'm seeing this on Vaadin 14.0.4. I'm using SpringBoot/tomcat as part of my framework.
As advised by the doco I turned off SpringBoot csrf handling.
Even though I'm getting this error the customer is seeing a error dialog pop up with an internal error indicated. The application however is fine!
I am seeing his exception partially reproduced here:
[ERROR] com.vaadin.flow.server.DefaultErrorHandler -
java.lang.UnsupportedOperationException: Confirmed duplicate message from the client. Expected sync id: 4, got 3. Message start: {"csrfToken":"0f9df571-94e1-4cf9-ba41-753b5c112731","rpc":[{"type":"event","node":4,"event":"click","data":{"event.shiftKey":false,"event.metaKey":false,"event.detail":1,"event.ctrlKey":false,"event.clientX":295,"event.clientY":881,"event.altKey":false,"event.button":0,"event.screenY":1009,"event.screenX":295}}],"syncId":3,"clientId":3}
at com.vaadin.flow.server.communication.ServerRpcHandler.handleRpc(ServerRpcHandler.java:294)
at com.vaadin.flow.server.communication.UidlRequestHandler.synchronizedHandleRequest(UidlRequestHandler.java:87)
at com.vaadin.flow.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:40)
at com.vaadin.flow.server.VaadinService.handleRequest(VaadinService.java:1540)
at com.vaadin.flow.server.VaadinServlet.service(VaadinServlet.java:246)
at com.vaadin.flow.spring.SpringServlet.service(SpringServlet.java:95)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:712)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:459)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:352)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:312)
at org.springframework.web.servlet.mvc.ServletForwardingController.handleRequestInternal(ServletForwardingController.java:141)
at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:177)
at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:52)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1039)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:908)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:660)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
...
etc etc
Please do not use Error in your Java code. Errors are special JVM exceptions which indicate serious JVM problem, such as OutOfMemoryError. When an Error is thrown, it is not expected for JVM to be able to continue; e.g. catching OutOfMemoryError and doing something about it will most likely cause another OutOfMemoryError to be thrown.
Quoting Error javadoc:
An Error is a subclass of Throwable
that indicates serious problems that a reasonable application
should not try to catch. Most such errors are abnormal conditions.
Instead of Errors, use RuntimeException.
Therefore, I'd perhaps propose to not give Errors any special treatment.
java.lang.UnsupportedOperationException: Unexpected message id from the client. Expected sync id: 0, got 1. Message start: {"csrfToken":"9608a964-6750-4a12-b241-e76d1dad2ad8","rpc":[{"type":"publishedEventHandler","node":9,"templateEventMethodName":"updateSelectedTab","templateEventMethodArgs":[true]}],"syncId":-1,"clientId":1}
I'm seeing a similar error. Vaadin 14.
I can confirm this bug is still existing in Vaadin 14.1.4. I would suggest to raise priority again!
I have removed the toString() method from my pojo and it start working.
I also can confirm this bug is still existing in Vaadin 14.3.7.
INFO com.vaadin.flow.server.communication.ServerRpcHandler - Ignoring old duplicate message from the client. Expected: 1, got: 0
I also can confirm this bug is still existing in Vaadin 14.3.7.
Hi @kolle1986 what do you mean ? The fix for this issue was to instead of throwing just log a message on the duplicate request. So the duplicate requests were not "removed" as this should be (?) enough.
Anyway, in case you see this all the time without a good reason and it is causing problems, please open a new issue with steps to reproduce.
I also can confirm this bug is still existing in Vaadin 14.3.7.
Hi @kolle1986 what do you mean ? The fix for this issue was to instead of throwing just log a message on the duplicate request. So the duplicate requests were not "removed" as this should be (?) enough.
Anyway, in case you see this all the time without a good reason and it is causing problems, please open a new issue with steps to reproduce.
From time to time on daily basis I have this error, with page loading forever. I tried to clean app server, clean project, rebuild, everything but sometimes it is not enough so I must reboot system and startup server again in order to run application. Talking about local development mode, really don't know what is the problem, just getting this info:
INFO com.vaadin.flow.server.communication.ServerRpcHandler - Ignoring old duplicate message from the client. Expected: 1, got: 0
Ok, thanks for the clarification, I understand now that this happens locally and on development time. Something is indeed going wrong but quite impossible to guess what that is without debugging deeper into what happens for processing that response. So like I said, in case get an idea on how to reproduce this, then please open a new issue.
Don't sure if that helped but after switched off xRebel error disapeared and managed to start project.
My colleague on the other hand, helped deleting everything in frontend module and regenerated it again. So, package.json, package-lock.json, webpack, webpack.config, webpack.generated, node_modules... after deletition managed to lose error.
Most helpful comment
do we have any updated on this issue?
I am facing same issue for vaadin 10.