Server push with Upload problem

Hi,

I’m using Vaadin 7.1.0.beta1, and trying to implement Upload together with server push enabled.
Upload seems to be working fine, as server recieves file and all listeners are fired correctly.
But the problem is that, as soon as upload starts, the client goes berserk and start sending tons of text to javascript console log (it prints the following lines several times per second). I assume it is trying to update UI after upload has finished, but it seems to do it too often, and it doesn’t ever stop.

Tested on Tomcat 6 and 7, and Firefox 10 and latest Chrome. When push is not enabled, the same upload works without problems.


@Push
public class TestUI extends UI {
	protected void init(VaadinRequest request) {

		VerticalLayout uiLayout = new VerticalLayout();
		setContent(uiLayout);

		Upload upload = new Upload("Upload", new Receiver() {
			@Override
			public OutputStream receiveUpload(String filename, String mimeType) {
				return new ByteArrayOutputStream();
			}
		});

		upload.addFinishedListener(new FinishedListener() {
			@Override
			public void uploadFinished(FinishedEvent event) {
				System.out.println("finished upload, length: " + event.getLength());
			}
		});

		uiLayout.addComponent(upload);
	}
}

Javascript console fragment:


Thu Jun 06 10:58:13 GMT+200 2013 com.vaadin.client.VConsole
INFO: Visiting server to see if upload started event changed UI. 0.js:5783
Thu Jun 06 10:58:13 GMT+200 2013 com.vaadin.client.VConsole
INFO: Making UIDL Request with params: 292413fe-0140-4059-88a0-227d5ae14758[["4","v","v",["pollForStart",["i","1"]
]]] 0.js:5783
Thu Jun 06 10:58:13 GMT+200 2013 com.vaadin.client.VConsole
INFO: Sending push message: 292413fe-0140-4059-88a0-227d5ae14758[["4","v","v",["pollForStart",["i","1"]
]]] 0.js:5783
Thu Jun 06 10:58:13 GMT+200 2013 com.vaadin.client.VConsole
INFO: Received push message: for(;;);[{"changes" : [["change",{"pid":"4"},["1",{"id":"4","notStarted":true}]
]], "state":{}, "types":{"4":"1"}, "hierarchy":{"4":[]}, "rpc" : []
, "meta" : {}, "resources" : {}, "locales": [{"name":"en_US","smn":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]
,"mn":["January","February","March","April","May","June","July","August","September","October","November","December"]
,"sdn":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]
,"dn":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]
,"fdow":0,"df":"M/d/yy","thc":true,"hmd":":","ampm":["AM","PM"]
}], "timings":[13044, 19]
}] 0.js:5783
Thu Jun 06 10:58:13 GMT+200 2013 com.vaadin.client.VConsole
INFO: JSON parsing took 0ms 0.js:5783
Thu Jun 06 10:58:13 GMT+200 2013 com.vaadin.client.VConsole
INFO: Handling message from server 0.js:5783
Thu Jun 06 10:58:13 GMT+200 2013 com.vaadin.client.VConsole
INFO:  * Handling resources from server 0.js:5783
Thu Jun 06 10:58:13 GMT+200 2013 com.vaadin.client.VConsole
INFO:  * Handling type inheritance map from server 0.js:5783
Thu Jun 06 10:58:13 GMT+200 2013 com.vaadin.client.VConsole
INFO: Handling type mappings from server 0.js:5783
Thu Jun 06 10:58:13 GMT+200 2013 com.vaadin.client.VConsole
INFO: Handling resource dependencies 0.js:5783
Thu Jun 06 10:58:13 GMT+200 2013 com.vaadin.client.VConsole
INFO:  * Handling locales 0.js:5783
Thu Jun 06 10:58:13 GMT+200 2013 com.vaadin.client.VConsole
INFO:  * Handling meta information 0.js:5783
Thu Jun 06 10:58:13 GMT+200 2013 com.vaadin.client.VConsole
INFO:  * Creating connectors (if needed) 0.js:5783
Thu Jun 06 10:58:13 GMT+200 2013 com.vaadin.client.VConsole
INFO:  * Updating connector states 0.js:5783
Thu Jun 06 10:58:13 GMT+200 2013 com.vaadin.client.VConsole
INFO:  * Updating connector hierarchy 0.js:5783
Thu Jun 06 10:58:13 GMT+200 2013 com.vaadin.client.VConsole
INFO:  * Running @DelegateToWidget 0.js:5783
Thu Jun 06 10:58:13 GMT+200 2013 com.vaadin.client.VConsole
INFO:  * Sending state change events 0.js:5783
Thu Jun 06 10:58:13 GMT+200 2013 com.vaadin.client.VConsole
INFO:  * Passing UIDL to Vaadin 6 style connectors 0.js:5783
Thu Jun 06 10:58:13 GMT+200 2013 com.vaadin.client.VConsole
INFO:  * Performing server to client RPC calls 0.js:5783
Thu Jun 06 10:58:13 GMT+200 2013 com.vaadin.client.VConsole
INFO: * Unregistered 0 connectors 0.js:5783
Thu Jun 06 10:58:13 GMT+200 2013 com.vaadin.client.VConsole
INFO: handleUIDLMessage: 3 ms 0.js:5783
Thu Jun 06 10:58:13 GMT+200 2013 com.vaadin.client.VConsole
INFO: Starting layout phase 0.js:5783
Thu Jun 06 10:58:13 GMT+200 2013 com.vaadin.client.VConsole
INFO: Measured 2 non connector elements 0.js:5783
Thu Jun 06 10:58:13 GMT+200 2013 com.vaadin.client.VConsole
INFO: Pass 1 measured 3 elements, fired 0 listeners and did 0 layouts. 0.js:5783
Thu Jun 06 10:58:13 GMT+200 2013 com.vaadin.client.VConsole
INFO: No more changes in pass 2 0.js:5783
Thu Jun 06 10:58:13 GMT+200 2013 com.vaadin.client.VConsole
INFO: Total layout phase time: 2ms 0.js:5783
Thu Jun 06 10:58:13 GMT+200 2013 com.vaadin.client.VConsole
INFO:  Processing time was 9ms for 611 characters of JSON 0.js:5783
Thu Jun 06 10:58:13 GMT+200 2013 com.vaadin.client.VConsole
INFO: Referenced paintables: 7 0.js:5783

There seems to be a problem with the upload component if you upload a small file and have push enabled which can cause it to keep polling the server forever after the upload has completed. Created http://dev.vaadin.com/ticket/12014