Using any of 7.1.2, 7.1.3 and 7.1.5 , we are seeing a problem under certain circumstance with Push enabled where a queued JavaScriptFunction callback push message appears to be sent according to the js console, but the server never receives the request. I have confirmed that the server isn’t blocked on any particular thread
We are using JBoss and we see that we fallback to streaming, and push normally works fine. But under certain circumstances, reproducible by rapidly bringing up multiple tabs with the same page, the queued message problem kicks in and our page is broken. This failure situation comes up for us frequently when we are using TestBench with GhostDriver. We see it in Chrome as well - haven’t tried other browsers.
In our environment, we run in embedded mode where we wait for the embedded page to be loaded before we complete our Vaadin “view load”, with the following code in our UI class:
@Override
protected void init(VaadinRequest vaadinRequest) {
//setup the communication channel between our shell app and this vaadin app
JavaScript.getCurrent().addFunction("fooo.vaadin.sendWorkContext", new SendWorkContextJavaScriptFunction());
//tell the shell that vaadin is currently ready to accept communication from it
JavaScript.getCurrent().execute("vaadinBridge.onVaadinReady();");
//Create a loading message while we wait for the shell to start communication with us
VerticalLayout content = new VerticalLayout();
content.setSizeFull();
addStyleName("embedded-app");
}
Here we init(), then wait for the parent page to load some “work context” details which our Vaadin app requires before it can load its actual content.
Normally this works fine event with push enabled (the js callback is queued waiting for push to init and then gets called), but in the error circumstance, the queued push request never comes back that runs the SendWorkContextJavaScriptFunction.call(), and our page never loads.
I’m curious if this is something anyone has thoughts on. I’m happy to create a Trac issue as well.
Trying to troubleshoot the issue I looked at the js console output (shown below) in the working and failing cases and also watched the servlet.service() calls to see what is different in the two cases. Unfortunately as seen below the only thing that appears different is that in the failing case the push message request is never received by the servlet.
Normal working case:
Thu Sep 19 10:42:14 GMT-500 2013 com.vaadin.client.VConsole
INFO: Starting application vaadin-app 0.js:6610
Thu Sep 19 10:42:14 GMT-500 2013 com.vaadin.client.VConsole
INFO: Using theme: tetris 0.js:6610
Thu Sep 19 10:42:14 GMT-500 2013 com.vaadin.client.VConsole
INFO: Server to client RPC call: 304:com.vaadin.shared.extension.javascriptmanager.ExecuteJavaScriptRpc.executeJavaScript([vaadinBridge.onVaadinReady();]
) 0.js:6610
Vaadin is ready to start shell communications push:262
Thu Sep 19 10:42:14 GMT-500 2013 com.vaadin.client.VConsole
INFO: Making UIDL Request with params: 75080f3a-aed1-4822-9a60-a55a30fdddcf
[["304","com.vaadin.ui.JavaScript$JavaScriptCallbackRpc","call",["fooo.vaadin.sendWorkContext",[{--json-snipped--}]
]]] 0.js:6610
Thu Sep 19 10:42:14 GMT-500 2013 com.vaadin.client.VConsole
INFO: Queuing push message: 75080f3a-aed1-4822-9a60-a55a30fdddcf[["304","com.vaadin.ui.JavaScript$JavaScriptCallbackRpc","call",
["fooo.vaadin.sendWorkContext",[{--json-snipped--}]
]]] 0.js:6610
Vaadin push loaded vaadinPush.js:23
Thu Sep 19 10:42:14 GMT-500 2013 com.vaadin.client.VConsole
INFO: vaadinPush.js loaded 0.js:6610
Thu Sep 19 10:42:14 GMT-500 2013 com.vaadin.client.VConsole
INFO: Establishing push connection 0.js:6610
WebSocket connection to 'ws://localhost:8080/vaadin/PUSH/?v-uiId=12&v-csrfToken=75080f3a-aed1-4822-9a60-a55a30fdddcf&
X-Atmosphere-tracking-id=0&X-Atmosphere-Framework=1.0.14.vaadin4&X-Atmosphere-Transport=websocket&X-Atmosphere-TrackMessageSize=true&
X-Cache-Date=0&Content-Type=application/json;%20charset=UTF-8' failed: Unexpected response code: 501 vaadinPush.js:23
Websocket closed, reason: Connection was closed abnormally (that is, with no close frame being sent). vaadinPush.js:23
Websocket closed, wasClean: false vaadinPush.js:23
Thu Sep 19 10:42:14 GMT-500 2013 com.vaadin.client.VConsole
INFO: Push connection closed, awaiting reconnection 0.js:6610
Websocket failed. Downgrading to Comet and resending vaadinPush.js:23
Thu Sep 19 10:42:14 GMT-500 2013 com.vaadin.client.VConsole
INFO: Push connection using primary method (websocket) failed. Trying with streaming 0.js:6610
Thu Sep 19 10:42:14 GMT-500 2013 com.vaadin.client.VConsole
INFO: Push connection established using streaming 0.js:6610
Thu Sep 19 10:42:14 GMT-500 2013 com.vaadin.client.VConsole
INFO: Sending push message: 75080f3a-aed1-4822-9a60-a55a30fdddcf[["304","com.vaadin.ui.JavaScript$JavaScriptCallbackRpc","call",
["fooo.vaadin.sendWorkContext",[{--json-snipped--}]
]]] 0.js:6610
Thu Sep 19 10:42:14 GMT-500 2013 com.vaadin.client.VConsole
INFO: Received push message: for(;;);[{"changes" : [["change",{"pid":"303"},["54",{"id":"303","location":"http:\/\/localhost:8080\/solutions\/push#\/p5"}]
],
["change",{"pid":"305"},["55",{"id":"305","v":{"selected":"1"}},["tabs",{},["tab",{"caption":"Push","key":"1","selected":true},["56",{"id":"307","cached":true}]
],
["tab",{"caption":"Broadcast","key":"2"}]
]]]], "state":{"305":{"immediate":true,"height":"100.0%","width":"100.0%","styles":["minimal"]
},"312":{--json-snipped--},
"scriptDependencies": ["published:///SimpleToolTipExtension.js"]
, "timings":[64872, 3]
}]
Failing case:
Thu Sep 19 10:52:36 GMT-500 2013 com.vaadin.client.VConsole
INFO: Starting application vaadin-app 0.js:6610
Thu Sep 19 10:52:36 GMT-500 2013 com.vaadin.client.VConsole
INFO: Using theme: tetris 0.js:6610
Thu Sep 19 10:52:36 GMT-500 2013 com.vaadin.client.VConsole
INFO: Server to client RPC call: 446:com.vaadin.shared.extension.javascriptmanager.ExecuteJavaScriptRpc.executeJavaScript([vaadinBridge.onVaadinReady();]
) 0.js:6610
Vaadin is ready to start shell communications push:262
Thu Sep 19 10:52:36 GMT-500 2013 com.vaadin.client.VConsole
INFO: Making UIDL Request with params: 75080f3a-aed1-4822-9a60-a55a30fdddcf[["446","com.vaadin.ui.JavaScript$JavaScriptCallbackRpc","call",
["fooo.vaadin.sendWorkContext",[{--json-snipped--}]
]]] 0.js:6610
Thu Sep 19 10:52:36 GMT-500 2013 com.vaadin.client.VConsole
INFO: Queuing push message: 75080f3a-aed1-4822-9a60-a55a30fdddcf[["446","com.vaadin.ui.JavaScript$JavaScriptCallbackRpc","call",
["fooo.vaadin.sendWorkContext",[{--json-snipped--}]
]]] 0.js:6610
Vaadin push loaded vaadinPush.js:23
Thu Sep 19 10:52:36 GMT-500 2013 com.vaadin.client.VConsole
INFO: vaadinPush.js loaded 0.js:6610
Thu Sep 19 10:52:36 GMT-500 2013 com.vaadin.client.VConsole
INFO: Establishing push connection 0.js:6610
WebSocket connection to 'ws://localhost:8080/vaadin/PUSH/?v-uiId=26&v-csrfToken=75080f3a-aed1-4822-9a60-a55a30fdddcf&
X-Atmosphere-tracking-id=0&X-Atmosphere-Framework=1.0.14.vaadin4&X-Atmosphere-Transport=websocket&X-Atmosphere-TrackMessageSize=true&
X-Cache-Date=0&Content-Type=application/json;%20charset=UTF-8' failed: Unexpected response code: 501 vaadinPush.js:23
Websocket closed, reason: Connection was closed abnormally (that is, with no close frame being sent). vaadinPush.js:23
Websocket closed, wasClean: false vaadinPush.js:23
Thu Sep 19 10:52:36 GMT-500 2013 com.vaadin.client.VConsole
INFO: Push connection closed, awaiting reconnection 0.js:6610
Websocket failed. Downgrading to Comet and resending vaadinPush.js:23
Thu Sep 19 10:52:36 GMT-500 2013 com.vaadin.client.VConsole
INFO: Push connection using primary method (websocket) failed. Trying with streaming 0.js:6610
Thu Sep 19 10:52:36 GMT-500 2013 com.vaadin.client.VConsole
INFO: Push connection established using streaming 0.js:6610
Thu Sep 19 10:52:36 GMT-500 2013 com.vaadin.client.VConsole
INFO: Sending push message: 75080f3a-aed1-4822-9a60-a55a30fdddcf[["446","com.vaadin.ui.JavaScript$JavaScriptCallbackRpc","call",
["fooo.vaadin.sendWorkContext",[{--json-snipped--}]
]]] 0.js:6610
Thu Sep 19 10:52:37 GMT-500 2013 com.vaadin.client.VConsole
INFO: New window width: 1743 0.js:6610
Thu Sep 19 10:52:37 GMT-500 2013 com.vaadin.client.VConsole
INFO: New window height: 1187 0.js:6610
Thu Sep 19 10:52:37 GMT-500 2013 com.vaadin.client.VConsole
INFO: New parent width: 1729
..etc with no push message recieved and servlet.service() push request never called
(eventually heartbeat request does go through successfully, but push request never completes so our UI never loads)