Open khauser opened 7 years ago
Sounds like the push channel is never reconnected after the first push. Try adding ?debug=push to the URL and look at the Chrome console for errors
Chrome does only give me an error when I'm using the proxy: WebSocket connection to 'wss://localhost/ui/vaadinServlet/PUSH?v-uiId=5&v-csrfToken=00d7c949-f48a-40…e=true&Content-Type=application/json;%20charset=UTF-8&X-atmo-protocol=true' failed: Error during WebSocket handshake: Unexpected response code: 400
in line 1195
With Firefox I get some more..
First with proxy and long-polling it brings XML-Verarbeitungsfehler: Syntax-Fehler Adresse: https://localhost/ui/vaadinServlet/PUSH?v-uiId=6&v-csrfToken=bab11853-73b7-400a-8463-73a9a01ca0e8&X-Atmosphere-tracking-id=0&X-Atmosphere-Framework=2.2.13.vaadin5-javascript&X-Atmosphere-Transport=long-polling&X-Atmosphere-TrackMessageSize=true&Content-Type=application%2Fjson%3B%20charset%3DUTF-8&X-atmo-protocol=true&_=1486156414064 Zeile Nr. 2, Spalte 1:
.
If I follow the url the result is: 40|a91c6a71-fda0-49c4-82b9-548ed5b6f86b|0||
Without proxy: XML-Verarbeitungsfehler: Kein Wurzel-Element gefunden Adresse: https://localhost:8081/ui/vaadinServlet/PUSH?v-uiId=10&v-csrfToken=bab11853-73b7-400a-8463-73a9a01ca0e8&X-Atmosphere-Transport=close&X-Atmosphere-tracking-id=ae1fa869-8d6a-42a9-92d5-92c7a40c9d0a&_=1486157591852 Zeile Nr. 1, Spalte 1:
Maybe it has to do with serializing the VaadinSession in spring-redis-session. This seems to bring problems with the push communication.
It definetly has something to do with the Vaadin session serialization.
Here is a much simpler sample project from @alejandro-du where push is hanging/not working: https://github.com/khauser/vaadin-spring-session-demo/tree/showcase/PushNotWorking
From the Atmosphere trace log:
2017-02-10 08:42:57.135 TRACE 2228 --- [hared-AsyncOp-0] org.atmosphere.cpr.DefaultBroadcaster : About to write to AtmosphereResource{
uuid=f168a537-8bac-49f8-be4a-f56c24aa42a2,
transport=WEBSOCKET,
isInScope=true,
isResumed=false,
isCancelled=false,
isSuspended=true,
broadcaster=/* size: 1,
isClosedByClient=false,
isClosedByApplication=false,
action=Action{timeout=-1, type=SUSPEND}}
2017-02-10 08:42:57.135 TRACE 2228 --- [hared-AsyncOp-0] o.atmosphere.cache.UUIDBroadcasterCache : Removing for AtmosphereResource f168a537-8bac-49f8-be4a-f56c24aa42a2 cached message for(;;);[{"syncId": 1, "clientId": 0, "changes" : [], "state":{"1":{"childData":{"2":{"alignmentBitmask":5,"expandRatio":0},"3":{"alignmentBitmask":5,"expandRatio":0}}},"3":{"text":"Hallo"}}, "types":{"1":"2","3":"11"}, "hierarchy":{"1":["2","3"]}, "rpc" : [], "meta" : {"async":true}, "resources" : {}, "typeMappings" : { "com.vaadin.ui.Label" : 11 }, "typeInheritanceMap" : { "3" : 6 , "4" : 5 , "5" : 9 , "11" : 3 , "2" : 4 , "9" : 3 }, "timings":[540, 304]}]
2017-02-10 08:42:57.135 TRACE 2228 --- [hared-AsyncOp-0] org.atmosphere.cpr.DefaultBroadcaster : /* is broadcasting to f168a537-8bac-49f8-be4a-f56c24aa42a2
2017-02-10 08:42:57.136 TRACE 2228 --- [hared-AsyncOp-0] org.atmosphere.websocket.WebSocket : WebSocket.write() for(;;);[{"syncId": 1, "clientId": 0, "changes" : [], "state":{"1":{"childData":{"2":{"alignmentBitmask":5,"expandRatio":0},"3":{"alignmentBitmask":5,"expandRatio":0}}},"3":{"text":"Hallo"}}, "types":{"1":"2","3":"11"}, "hierarchy":{"1":["2","3"]}, "rpc" : [], "meta" : {"async":true}, "resources" : {}, "typeMappings" : { "com.vaadin.ui.Label" : 11 }, "typeInheritanceMap" : { "3" : 6 , "4" : 5 , "5" : 9 , "11" : 3 , "2" : 4 , "9" : 3 }, "timings":[540, 304]}]
2017-02-10 08:42:57.137 TRACE 2228 --- [hared-AsyncOp-0] o.atmosphere.cpr.AtmosphereResourceImpl : Invoking listener [com.vaadin.server.communication.PushAtmosphereHandler$AtmosphereResourceListener@5fdf643e] for f168a537-8bac-49f8-be4a-f56c24aa42a2
2017-02-10 08:42:57.138 TRACE 2228 --- [hared-AsyncOp-0] c.AtmosphereResourceEventListenerAdapter : AtmosphereResourceEventImpl{ isCancelled=false isClosedByClient=false isClosedByApplication=false isResumedOnTimeout=false throwable=null resource=null}
2017-02-10 08:43:06.421 DEBUG 2228 --- [ Thread-5] com.vaadin.ui.ConnectorTracker : com.vaadin.ui.Label(4) (parent: com.vaadin.ui.HorizontalLayout(1)) is now dirty
2017-02-10 08:43:06.422 DEBUG 2228 --- [ Thread-5] com.vaadin.ui.ConnectorTracker : Registered Label (4)
Here it stops and invalidates the client after some time.
Without the redis-session dependencies it would continue with:
2017-02-10 08:34:26.460 DEBUG 8056 --- [ Thread-4] com.vaadin.ui.ConnectorTracker : com.vaadin.ui.HorizontalLayout(1) (parent: com.example.VaadinUI(0)) is now dirty
2017-02-10 08:34:26.460 DEBUG 8056 --- [ Thread-4] c.v.server.communication.UidlWriter : * Creating response to client
2017-02-10 08:34:26.460 DEBUG 8056 --- [ Thread-4] c.v.server.communication.UidlWriter : Found 2 dirty connectors to paint
2017-02-10 08:34:26.461 DEBUG 8056 --- [ Thread-4] com.vaadin.ui.ConnectorTracker : All connectors are now clean
2017-02-10 08:34:26.462 TRACE 8056 --- [ed-DispatchOp-0] org.atmosphere.cpr.DefaultBroadcaster : /* is about to broadcast Entry{message=for(;;);[{"syncId": 2, "clientId": 0, "changes" : [], "state":{"1":{"childData":{"2":{"alignmentBitmask":5,"expandRatio":0},"3":{"alignmentBitmask":5,"expandRatio":0},"4":{"alignmentBitmask":5,"expandRatio":0}}},"4":{"text":"Du"}}, "types":{"1":"1","4":"11"}, "hierarchy":{"1":["2","3","4"]}, "rpc" : [], "meta" : {"async":true}, "resources" : {}, "timings":[315, 216]}], type=RESOURCE, future=org.atmosphere.cpr.BroadcasterFuture@1ec44f1c}
2017-02-10 08:34:26.462 TRACE 8056 --- [ed-DispatchOp-0] o.atmosphere.cache.UUIDBroadcasterCache : Adding for AtmosphereResource 1fa20a58-f7f5-43b3-809b-27a9221821c4 cached messages for(;;);[{"syncId": 2, "clientId": 0, "changes" : [], "state":{"1":{"childData":{"2":{"alignmentBitmask":5,"expandRatio":0},"3":{"alignmentBitmask":5,"expandRatio":0},"4":{"alignmentBitmask":5,"expandRatio":0}}},"4":{"text":"Du"}}, "types":{"1":"1","4":"11"}, "hierarchy":{"1":["2","3","4"]}, "rpc" : [], "meta" : {"async":true}, "resources" : {}, "timings":[315, 216]}]
2017-02-10 08:34:26.462 TRACE 8056 --- [ed-DispatchOp-0] o.atmosphere.cache.UUIDBroadcasterCache : Active clients {1fa20a58-f7f5-43b3-809b-27a9221821c4=1486712057185}
2017-02-10 08:34:26.462 TRACE 8056 --- [ed-DispatchOp-0] org.atmosphere.cpr.DefaultBroadcaster : AtmosphereResource 1fa20a58-f7f5-43b3-809b-27a9221821c4 available for for(;;);[{"syncId": 2, "clientId": 0, "changes" : [], "state":{"1":{"childData":{"2":{"alignmentBitmask":5,"expandRatio":0},"3":{"alignmentBitmask":5,"expandRatio":0},"4":{"alignmentBitmask":5,"expandRatio":0}}},"4":{"text":"Du"}}, "types":{"1":"1","4":"11"}, "hierarchy":{"1":["2","3","4"]}, "rpc" : [], "meta" : {"async":true}, "resources" : {}, "timings":[315, 216]}]
2017-02-10 08:34:26.462 TRACE 8056 --- [ed-DispatchOp-0] org.atmosphere.cpr.DefaultBroadcaster : Broadcaster /* is about to queueWriteIO for AtmosphereResource 1fa20a58-f7f5-43b3-809b-27a9221821c4
2017-02-10 08:34:26.463 TRACE 8056 --- [hared-AsyncOp-1] org.atmosphere.cpr.DefaultBroadcaster : About to write to AtmosphereResource{
uuid=1fa20a58-f7f5-43b3-809b-27a9221821c4,
transport=WEBSOCKET,
isInScope=true,
isResumed=false,
isCancelled=false,
isSuspended=true,
broadcaster=/* size: 1,
isClosedByClient=false,
isClosedByApplication=false,
action=Action{timeout=-1, type=SUSPEND}}
2017-02-10 08:34:26.463 TRACE 8056 --- [hared-AsyncOp-1] o.atmosphere.cache.UUIDBroadcasterCache : Removing for AtmosphereResource 1fa20a58-f7f5-43b3-809b-27a9221821c4 cached message for(;;);[{"syncId": 2, "clientId": 0, "changes" : [], "state":{"1":{"childData":{"2":{"alignmentBitmask":5,"expandRatio":0},"3":{"alignmentBitmask":5,"expandRatio":0},"4":{"alignmentBitmask":5,"expandRatio":0}}},"4":{"text":"Du"}}, "types":{"1":"1","4":"11"}, "hierarchy":{"1":["2","3","4"]}, "rpc" : [], "meta" : {"async":true}, "resources" : {}, "timings":[315, 216]}]
2017-02-10 08:34:26.463 TRACE 8056 --- [hared-AsyncOp-1] org.atmosphere.cpr.DefaultBroadcaster : /* is broadcasting to 1fa20a58-f7f5-43b3-809b-27a9221821c4
2017-02-10 08:34:26.464 TRACE 8056 --- [hared-AsyncOp-1] org.atmosphere.websocket.WebSocket : WebSocket.write() for(;;);[{"syncId": 2, "clientId": 0, "changes" : [], "state":{"1":{"childData":{"2":{"alignmentBitmask":5,"expandRatio":0},"3":{"alignmentBitmask":5,"expandRatio":0},"4":{"alignmentBitmask":5,"expandRatio":0}}},"4":{"text":"Du"}}, "types":{"1":"1","4":"11"}, "hierarchy":{"1":["2","3","4"]}, "rpc" : [], "meta" : {"async":true}, "resources" : {}, "timings":[315, 216]}]
2017-02-10 08:34:26.464 TRACE 8056 --- [hared-AsyncOp-1] o.atmosphere.cpr.AtmosphereResourceImpl : Invoking listener [com.vaadin.server.communication.PushAtmosphereHandler$AtmosphereResourceListener@73b946c7] for 1fa20a58-f7f5-43b3-809b-27a9221821c4
2017-02-10 08:34:26.464 TRACE 8056 --- [hared-AsyncOp-1] c.AtmosphereResourceEventListenerAdapter : AtmosphereResourceEventImpl{ isCancelled=false isClosedByClient=false isClosedByApplication=false isResumedOnTimeout=false throwable=null resource=null}
After some investigations I found out that the main problem here lies in the serialization of the AtmosphereResource which is marked transient
(see https://github.com/vaadin/framework/issues/3753) within the AtmospherePushConnection, and is not reinitialized after the first push. Till now I was not able whether to reinitialize it myself or to make it serializable with extends\implements Serializable
, some transients and a serializer from here: http://stackoverflow.com/questions/24532649/atmosphereresource-become-null. Actually it fails with a state issue [isReady]
of the AtmosphereResponse
I maybe next week get to the atmosphere issue tracker and raise a new one with the complete stacktrace of serialization exception.
A lot of tickets have been left hanging in the issue tracker through the years. Some of them are still relevant, some of them have been fixed a long time ago and some are no longer valid. To get a better look on what is important and still relevant, we are closing old tickets which have not been touched in a long time. No further work will be done on this ticket. If the ticket seems to be still actual, please verify the problem existence over latest framework version and then open a new ticket in vaadin/framework with all the suitable information.
Hello there!
We are sorry that this issue hasn't progressed lately. We are prioritizing issues by severity and the number of customers we expect are experiencing this and haven't gotten around to fix this issue yet.
There are a couple of things you could help to get things rolling on this issue (this is an automated message, so expect that some of these are already in use):
Thanks again for your contributions! Even though we haven't been able to get this issue fixed, we hope you to report your findings and enhancement ideas in the future too!
This could be fixed by https://github.com/vaadin/framework/pull/11988
Vaadin version: 7.7.6 Spring boot version: 1.4.2 Spring vaadin version: 1.2.0
If I try to add the following code from the vaadin book to a demo vaadin application:
(togehter with @Push at UI and the gradle vaadin-push-dependency) all is fine and I get a "Du" after 10 Seconds.
But if I do it in my more complex project it only works if I set the sleep to zero. In all cases I also get a warning after some time like this one:
WARN 12964 --- [nio-8081-exec-8] org.atmosphere.cpr.DefaultBroadcaster : Duplicate resource df019f74-2461-4ae6-b539-e16d9bae6b2f. Could be caused by a dead connection not detected by your server. Replacing the old one with the fresh one
A showcase scenario you can find here: https://github.com/khauser/microservices4vaadin/tree/PushFailure with the related code from above under
microservices/frontend/src/main/java/microservices4vaadin/frontend/ui/HomeView.java
It doesn't matter if you call the frontend directly or through a proxy, in both I get no "Du"
I would appreciate some help here, since I also want to use the greate Push-feature.
Have a nice weekend!