vaadin / framework

Vaadin 6, 7, 8 is a Java framework for modern Java web applications.
http://vaadin.com/
Other
1.78k stars 730 forks source link

Push(streaming) does not work in IE9 under https - also FF #4176

Closed vaadin-bot closed 11 years ago

vaadin-bot commented 11 years ago

Originally by CodingFabian


When I deploy a push enabled application (choosing transport streaming) to a tomcat running on https, I get this error message in the IE 9 console:

SEC7111: HTTPS security is compromised by https://server:443/context-root/PUSH/?v-uiId=37&v-csrfToken=24914274-910f-4753-8094-b4b82fa066a5&X-Atmosphere-tracking-id=0&X-Atmosphere-Framework=1.0.13&X-Atmosphere-Transport=streaming&X-Atmosphere-TrackMessageSize=true&X-Cache-Date=0&Content-Type=application/json; charset=UTF-8&_=1373485923634


Imported from https://dev.vaadin.com/ issue #12196

vaadin-bot commented 11 years ago

Originally by CodingFabian


ps: why does it say 1.0.13? shouldn't it say also

vaadin-bot commented 11 years ago

Originally by CodingFabian


according to https://groups.google.com/forum/#!topic/atmosphere-framework/IX9x41i-tmc this seems to be caused by the iframe approach atmosphere uses in

function _configureIE(request) 

actually it chooses this branch here:

                if (jQuery.browser.msie && jQuery.browser.version < 10) {
                    if ((rq.transport == 'streaming')) {
                        rq.enableXDR && window.XDomainRequest ? _ieXDR(rq) : _ieStreaming(rq);
                        return;
                    }

                    if ((rq.enableXDR) && (window.XDomainRequest)) {
                        _ieXDR(rq);
                        return;
                    }
                }

you are not using https://github.com/Atmosphere/atmosphere/wiki/jQuery.atmosphere.js-API#enablexdr-default--false which, as far as i see is supported since ie8 and does perform a non iframe ajax call.

I will try that (add it to atmosphereconfig) and post if it improves the situation for me.

vaadin-bot commented 11 years ago

Originally by CodingFabian


just tested my patched version. First test was to patch the push.js to always use XDR. So even without setting the XDR enabled to true. I see the initial attempt bing made, but then it hangs. on serverside i see that no session information arrives. I will now try using the two flags for xdr and encoding the jsessionid and see how it goes

vaadin-bot commented 11 years ago

Originally by CodingFabian


i tried to enable xdr and enable url rewriting, but this produced this error

l 13 16:19:51 GMT+200 2013 com.vaadin.client.ApplicationConfiguration
SEVERE: (TypeError) 
 description: Function expected
 number: -2146823286: Function expectedcom.google.gwt.core.client.JavaScriptException: (TypeError) 
 description: Function expected
 number: -2146823286: Function expected

looking for more ideas.

vaadin-bot commented 11 years ago

Originally by CodingFabian


The following patch to AtmospherePushConnection seems to work to some extend:


    // uri is needed to identify the right connection when closing
    uri = ApplicationConnection.addGetParameters(baseUrl, extraParams);

    int pathSlash = uri.indexOf('/', 8);
    uri = uri.substring(pathSlash);

    VConsole.log("Establishing push connection to " + uri);
    socket = doConnect(uri, getConfig());

I already observed that loading flash in IE under https does not work if the domain url is fully qualified. server relative urls however work. I assumed that the same might apply to the iframe, and so far i can get push working most of the time. I still have issues with IE9, but I assume that it is a good idea to make only a server relative url instead of fully qualifying it. My patch is a bit hacky. connection.translateVaadinUri will always prepend the server name. By looking for the '/' from position 8, i am guaranteed to find the context root slash.

vaadin-bot commented 11 years ago

Originally by CodingFabian


as said, the connection seems to work, but the app is still not stable. especially file uploads seem to fail

vaadin-bot commented 11 years ago

Originally by @jdahlstrom


Thanks for the analysis! Seems weird if file uploads fail, given that they shouldn't depend on push at all... except that the upload component does poll the server for progress, might be that those requests stall somehow.

vaadin-bot commented 11 years ago

Originally by CodingFabian


its IE. everything after the first JS error is indeterministic :-)

I will perform a full scale IE compatibility testing today, and let you know what I find out. so far it looks i will at least go for the server relative url, rather than fully qualified.

vaadin-bot commented 11 years ago

Originally by CodingFabian


Mon Jul 15 20:48:21 GMT+200 2013 com.vaadin.client.VConsole SEVERE: No active request Mon Jul 15 20:48:21 GMT+200 2013 com.vaadin.client.VConsole So with my "remove host fix". The application mostly works. even one upload was okay. the second upload produces this:

SEVERE: Communication error: (SyntaxError) 
 description: Unterminated string constant
 number: -2146827273: Unterminated string constant - Original JSON-text:{"changes" : [["change",{"pid":"1092"},["54",{"id":"1092","selectmode":"none","cols":2,"rows":2,"firstrow":0,"totalrows":2,"pagelength":5,"colfooters":false,"vcolorder":["1","2"],"pb-ft":0,"pb-l":1,"v":{"firstvisible":0,"sortcolumn":"3","sortascending":false,"reqrows":-1,"reqfirstrow":-1}},["rows",{},["tr",{"key":2},["55",{"id":"1114","cached":true}],["56",{"id":"1117","cached":true}]],["tr",{"key":3},["55",{"id":"1121","cache 
vaadin-bot commented 11 years ago

Originally by CodingFabian


I now can reproduce it in Firefox as well. It looks like a race condition I just got this error 5 times in a row, on the 6th time all was fine:

Mon Jul 15 20:59:06 GMT+200 2013 com.vaadin.client.VConsole
SEVERE: Communication error: (SyntaxError) 
 stack: wOb@https://server:8443/context/:52
PNb@https://server:8443/context/:114
wZb@https://server:8443/context/:0
d.onMessage<@https://server:8443/context/:44
sj@https://server:8443/context/:507
yj@https://server:8443/context/:145
@https://server:8443/context/:179
an@https://server:8443/context/VAADIN/vaadinPush.js:1
W@https://server:8443/context/VAADIN/vaadinPush.js:1
w@https://server:8443/context/VAADIN/vaadinPush.js:1
a.atmosphere.AtmosphereRequest/n/au.onreadystatechange@https://server:8443/context/VAADIN/vaadinPush.js:1

 fileName: https://server:8443/context/
 lineNumber: 52
 columnNumber: 0: invalid property id - Original JSON-text:{"changes" : [["change",{"pid":"3756"},["6",{"id":"3756","dragmode":2,"selectmode":"multi","cr":1.5,"cols":3,"rows":9,"firstrow":0,"totalrows":9,"pagelength":30,"colfooters":false,"vcolorder":["1","2","3"],"pb-ft":0,"pb-l":8,"clearKeyMap":true,"v":{"selected":[],"firstvisible":0,"reqrows":-1,"reqfirstrow":-1}},["rows",{},["tr",{"key":10,"rowstyle":"document","style-1":"thumbnail","style-2":"info","style-3":"icons"},["54",{"id":"3876","cached":true}],["55",{"id":"3877","cached":true}],["56",{"id":"3882","cached":true}]],["tr",{"key":11,"rowstyle":"document","style-1":"thumbnail","style-2":"info","style-3":"icons"},["54",{"id":"3889","cached":true}],["55",{"id":"3890","cached":true}],["56",{"id":"3895","cached":true}]],["tr",{"key":12,"rowstyle":"document","style-1":"thumbnail","style-2":"info","style-3":"icons"},["54",{"id":"3902","cached":true}],["55",{"id":"3903","cached":true}],["56",{"id":"3908","cached":true}]],["tr",{"key":13,"rowstyle":"document","style-1":"thumbnail","style-2":"info","style-3":"icons"},["54",{"id":"3915","cached":true}],["55",{"id":"3916","cached":true}],["56",{"id":"3921","cached":true}]],["tr",{"key":14,"rowstyle":"document","style-1":"thumbnail","style-2":"info","style-3":"icons"},["54",{"id":"3928","cached":true}],["55",{"id":"3929","cached":true}],["56",{"id":"3934","cached":true}]],["tr",{"key":15,"rowstyle":"document","style-1":"thumbnail","style-2":"info","style-3":"icons"},["54",{"id":"3941","cached":true}],["55",{"id":"3942","cached":true}],["56",{"id":"3947","cached":true}]],["tr",{"key":16,"rowstyle":"document","style-1":"thumbnail","style-2":"info","style-3":"icons"},["54",{"id":"3954","cached":true}],["55",{"id":"3955","cached":true}],["56",{"id":"3960","cached":true}]],["tr",{"key":17,"rowstyle":"document","style-1":"thumbnail","style-2":"info","style-3":"icons"},["54",{"id":"3967","cached":true}],["55",{"id":"3968","cached":true}],["56",{"id":"3973","cached":true}]],["tr",{"key":18,"rowstyle":"document","style-1":"thumbnail","style-2":"info","style-3":"icons"},["54",{"id":"3980","cached":true}],["55",{"id":"3981","cached":true}],["56",{"id":"3986","cached":true}]]],["visiblecolumns",{},["column",{"cid":"1","caption":"","fcaption":"","width":40}],["column",{"cid":"2","caption":"","fcaption":"","er":1.0}],["column",{"cid":"3","caption":"","fcaption":"","width":240}]]]]], "state":{"3875":{"text":"9 TREFFER","height":"24.0px","width":"100.0%","styles":["result-caption"]},"3878":{"styles":["document-file-name-button"],"caption":"08.jpg"},"3879":{"styles":["document-owner-button"],"caption":"Developer Account"},"3876":{"height":"32.0px","width":"40.0px","styles":["filetype-pictures","result-filetype"]},"3877":{"height":"32.0px","styles":["result-info-cell"]},"3928":{"height":"32.0px","width":"40.0px","styles":["filetype-pictures","result-filetype"]},"3929":{"height":"32.0px","styles":["result-info-cell"]},"3882":{"height":"30.0px","styles":["result-icon-cell"]},"3926":{"height":"30.0px","width":"40.0px","styles":["result-button-no-version"]},"3927":{"height":"30.0px","width":"40.0px","styles":["result-button-no-link"]},"3881":{"caption":"44,9 kB"},"3924":{"height":"30.0px","width":"40.0px","styles":["result-button-no-tag"]},"3880":{"caption":"15.07.2013 20:53"},"3925":{"height":"30.0px","width":"40.0px","styles":["result-button-no-comment"]},"3922":{"height":"30.0px","width":"40.0px","styles":["result-button-list"]},"3923":{"height":"30.0px","width":"40.0px","styles":["result-button-no-sharing"]},"3920":{"caption":"44,9 kB"},"3921":{"height":"30.0px","styles":["result-icon-cell"]},"3883":{"height":"30.0px","width":"40.0px","styles":["result-button-list"]},"3884":{"height":"30.0px","width":"40.0px","styles":["result-button-no-sharing"]},"3885":{"height":"30.0px","width":"40.0px","styles":["result-button-no-tag"]},"3886":{"height":"30.0px","width":"40.0px","styles":["result-button-no-comment"]},"3887":{"height":"30.0px","width":"40.0px","styles":["result-button-no-version"]},"3888":{"height":"30.0px","width":"40.0px","styles":["result-button-no-link"]},"3889":{"height":"32.0px","width":"40.0px","styles":["filetype-pictures","result-filetype"]},"3917":{"styles":["document-file-name-button"],"caption":"08.jpg"},"3918":{"styles":["document-owner-button"],"caption":"Developer Account"},"3919":{"caption":"15.07.2013 20:51"},"3891":{"styles":["document-file-name-button"],"caption":"09.jpg"},"3913":{"height":"30.0px","width":"40.0px","styles":["result-button-no-version"]},"3914":{"height":"30.0px","width":"40.0px","styles":["result-button-no-link"]},"3890":{"height":"32.0px","styles":["result-info-cell"]},"3893":{"caption":"15.07.2013 20:53"},"3915":{"height":"32.0px","width":"40.0px","styles":["filetype-pictures","result-filetype"]},"3892":{"styles":["document-owner-button"],"caption":"Developer Account"},"3916":{"height":"32.0px","styles":["result-info-cell"]},"3910":{"height":"30.0px","width":"40.0px","styles":["result-button-no-sharing"]},"3911":{"height":"30.0px","width":"40.0px","styles":["result-button-no-tag"]},"3912":{"heigh
https://server:8443/context//event/seq/1/uCe
Line 10
vaadin-bot commented 11 years ago

Originally by CodingFabian


I just intercepted the JSON Parser using firebug.

It says this:

JSON.parse: end of data after property value in object
Line 52

and the parameter it parses


{"changes" : [["change",{"pid":"5571"},["6",{"id":"5571","dragmode":2,"selectmode":"multi","cr":1.5,"cols":3,"rows":9,"firstrow":0,"totalrows":9,"pagelength":30,"colfooters":false,"vcolorder":["1","2","3"],"pb-ft":0,"pb-l":8,"clearKeyMap":true,"v":{"selected":[],"firstvisible":0,"reqrows":-1,"reqfirstrow":-1}},["rows",{},["tr",{"key":10,"rowstyle":"document","style-1":"thumbnail","style-2":"info","style-3":"icons"},["54",{"id":"5691","cached":true}],["55",{"id":"5692","cached":true}],["56",{"id":"5697","cached":true}]],["tr",{"key":11,"rowstyle":"document","style-1":"thumbnail","style-2":"info","style-3":"icons"},["54",{"id":"5704","cached":true}],["55",{"id":"5705","cached":true}],["56",{"id":"5710","cached":true}]],["tr",{"key":12,"rowstyle":"document","style-1":"thumbnail","style-2":"info","style-3":"icons"},["54",{"id":"5717","cached":true}],["55",{"id":"5718","cached":true}],["56",{"id":"5723","cached":true}]],["tr",{"key":13,"rowstyle":"document","style-1":"thumbnail","style-2":"info","style-3":"icons"},["54",{"id":"5730","cached":true}],["55",{"id":"5731","cached":true}],["56",{"id":"5736","cached":true}]],["tr",{"key":14,"rowstyle":"document","style-1":"thumbnail","style-2":"info","style-3":"icons"},["54",{"id":"5743","cached":true}],["55",{"id":"5744","cached":true}],["56",{"id":"5749","cached":true}]],["tr",{"key":15,"rowstyle":"document","style-1":"thumbnail","style-2":"info","style-3":"icons"},["54",{"id":"5756","cached":true}],["55",{"id":"5757","cached":true}],["56",{"id":"5762","cached":true}]],["tr",{"key":16,"rowstyle":"document","style-1":"thumbnail","style-2":"info","style-3":"icons"},["54",{"id":"5769","cached":true}],["55",{"id":"5770","cached":true}],["56",{"id":"5775","cached":true}]],["tr",{"key":17,"rowstyle":"document","style-1":"thumbnail","style-2":"info","style-3":"icons"},["54",{"id":"5782","cached":true}],["55",{"id":"5783","cached":true}],["56",{"id":"5788","cached":true}]],["tr",{"key":18,"rowstyle":"document","style-1":"thumbnail","style-2":"info","style-3":"icons"},["54",{"id":"5795","cached":true}],["55",{"id":"5796","cached":true}],["56",{"id":"5801","cached":true}]]],["visiblecolumns",{},["column",{"cid":"1","caption":"","fcaption":"","width":40}],["column",{"cid":"2","caption":"","fcaption":"","er":1.0}],["column",{"cid":"3","caption":"","fcaption":"","width":240}]]]]], "state":{"5736":{"height":"30.0px","styles":["result-icon-cell"]},"5735":{"caption":"44,9 kB"},"5738":{"height":"30.0px","width":"40.0px","styles":["result-button-no-sharing"]},"5737":{"height":"30.0px","width":"40.0px","styles":["result-button-list"]},"5732":{"styles":["document-file-name-button"],"caption":"08.jpg"},"5731":{"height":"32.0px","styles":["result-info-cell"]},"5734":{"caption":"15.07.2013 20:51"},"5733":{"styles":["document-owner-button"],"caption":"Developer Account"},"5739":{"height":"30.0px","width":"40.0px","styles":["result-button-no-tag"]},"5740":{"height":"30.0px","width":"40.0px","styles":["result-button-no-comment"]},"5741":{"height":"30.0px","width":"40.0px","styles":["result-button-no-version"]},"5749":{"height":"30.0px","styles":["result-icon-cell"]},"5748":{"caption":"77,2 kB"},"5747":{"caption":"15.07.2013 20:51"},"5746":{"styles":["document-owner-button"],"caption":"Developer Account"},"5745":{"styles":["document-file-name-button"],"caption":"10.jpg"},"5744":{"height":"32.0px","styles":["result-info-cell"]},"5743":{"height":"32.0px","width":"40.0px","styles":["filetype-pictures","result-filetype"]},"5742":{"height":"30.0px","width":"40.0px","styles":["result-button-no-link"]},"5751":{"height":"30.0px","width":"40.0px","styles":["result-button-no-sharing"]},"5752":{"height":"30.0px","width":"40.0px","styles":["result-button-no-tag"]},"5750":{"height":"30.0px","width":"40.0px","styles":["result-button-list"]},"5754":{"height":"30.0px","width":"40.0px","styles":["result-button-no-version"]},"5753":{"height":"30.0px","width":"40.0px","styles":["result-button-no-comment"]},"5756":{"height":"32.0px","width":"40.0px","styles":["filetype-pictures","result-filetype"]},"5755":{"height":"30.0px","width":"40.0px","styles":["result-button-no-link"]},"5758":{"styles":["document-file-name-button"],"caption":"09.jpg"},"5757":{"height":"32.0px","styles":["result-info-cell"]},"5759":{"styles":["document-owner-button"],"caption":"Developer Account"},"5557":{"childData":{"5561":{"expandRatio":0,"alignmentBitmask":5},"5560":{"expandRatio":0,"alignmentBitmask":34},"5564":{"expandRatio":0,"alignmentBitmask":33},"5563":{"expandRatio":0,"alignmentBitmask":5},"5562":{"expandRatio":0,"alignmentBitmask":33},"5690":{"expandRatio":1,"alignmentBitmask":33},"5558":{"expandRatio":0,"alignmentBitmask":5},"5568":{"expandRatio":0,"alignmentBitmask":5```,"5558":{"text":"1"},"5802":{"height":"30.0px","width":"40.0px","styles":["result-button-list"]},"5801":{"height":"30.0px","styles":["result-icon-cell"]},"5804":{"height":"30.0px","width":"40.0px","styles":["result-button-no-tag"]},"5803":{"height":"30.0px","width":"40.0px","styles":["result-button-no-sharing"]}
}}}
which is no valid json. Looks like it can happen that push sends out incomplete data via streaming
vaadin-bot commented 11 years ago

Originally by CodingFabian


another run says

JSON.parse: unterminated string
Line 52

{"changes" : [["change",{"pid":"6297"},["6",{"id":"6297","dragmode":2,"selectmode":"multi","cr":1.5,"cols":3,"rows":9,"firstrow":0,"totalrows":9,"pagelength":30,"colfooters":false,"vcolorder":["1","2","3"],"pb-ft":0,"pb-l":8,"clearKeyMap":true,"v":{"selected":[],"firstvisible":0,"reqrows":-1,"reqfirstrow":-1}},["rows",{},["tr",{"key":10,"rowstyle":"document","style-1":"thumbnail","style-2":"info","style-3":"icons"},["54",{"id":"6417","cached":true}],["55",{"id":"6418","cached":true}],["56",{"id":"6423","cached":true}]],["tr",{"key":11,"rowstyle":"document","style-1":"thumbnail","style-2":"info","style-3":"icons"},["54",{"id":"6430","cached":true}],["55",{"id":"6431","cached":true}],["56",{"id":"6436","cached":true}]],["tr",{"key":12,"rowstyle":"document","style-1":"thumbnail","style-2":"info","style-3":"icons"},["54",{"id":"6443","cached":true}],["55",{"id":"6444","cached":true}],["56",{"id":"6449","cached":true}]],["tr",{"key":13,"rowstyle":"document","style-1":"thumbnail","style-2":"info","style-3":"icons"},["54",{"id":"6456","cached":true}],["55",{"id":"6457","cached":true}],["56",{"id":"6462","cached":true}]],["tr",{"key":14,"rowstyle":"document","style-1":"thumbnail","style-2":"info","style-3":"icons"},["54",{"id":"6469","cached":true}],["55",{"id":"6470","cached":true}],["56",{"id":"6475","cached":true}]],["tr",{"key":15,"rowstyle":"document","style-1":"thumbnail","style-2":"info","style-3":"icons"},["54",{"id":"6482","cached":true}],["55",{"id":"6483","cached":true}],["56",{"id":"6488","cached":true}]],["tr",{"key":16,"rowstyle":"document","style-1":"thumbnail","style-2":"info","style-3":"icons"},["54",{"id":"6495","cached":true}],["55",{"id":"6496","cached":true}],["56",{"id":"6501","cached":true}]],["tr",{"key":17,"rowstyle":"document","style-1":"thumbnail","style-2":"info","style-3":"icons"},["54",{"id":"6508","cached":true}],["55",{"id":"6509","cached":true}],["56",{"id":"6514","cached":true}]],["tr",{"key":18,"rowstyle":"document","style-1":"thumbnail","style-2":"info","style-3":"icons"},["54",{"id":"6521","cached":true}],["55",{"id":"6522","cached":true}],["56",{"id":"6527","cached":true}]]],["visiblecolumns",{},["column",{"cid":"1","caption":"","fcaption":"","width":40}],["column",{"cid":"2","caption":"","fcaption":"","er":1.0}],["column",{"cid":"3","caption":"","fcaption":"","width":240}]]]]], "state":{"6423":{"height":"30.0px","styles":["result-icon-cell"]},"6422":{"caption":"44,9 kB"},"6421":{"caption":"15.07.2013 20:53"},"6420":{"styles":["document-owner-button"],"caption":"Developer Account"},"6492":{"height":"30.0px","width":"40.0px","styles":["result-button-no-comment"]},"6491":{"height":"30.0px","width":"40.0px","styles":["result-button-no-tag"]},"6416":{"text":"9 TREFFER","height":"24.0px","width":"100.0%","styles":["result-caption"]},"6490":{"height":"30.0px","width":"40.0px","styles":["result-button-no-sharing"]},"6419":{"styles":["document-file-name-button"],"caption":"08.jpg"},"6417":{"height":"32.0px","width":"40.0px","styles":["filetype-pictures","result-filetype"]},"6418":{"height":"32.0px","styles":["result-info-cell"]},"6499":{"caption":"15.07.2013 20:50"},"6498":{"styles":["document-owner-button"],"caption":"Developer Account"},"6497":{"styles":["document-file-name-button"],"caption":"20.jpg"},"6496":{"height":"32.0px","styles":["result-info-cell"]},"6495":{"height":"32.0px","width":"40.0px","styles":["filetype-pictures","result-filetype"]},"6494":{"height":"30.0px","width":"40.0px","styles":["result-button-no-link"]},"6493":{"height":"30.0px","width":"40.0px","styles":["result-button-no-version"]},"6284":{"text":"1"},"6468":{"height":"30.0px","width":"40.0px","styles":["result-button-no-link"]},"6469":{"height":"32.0px","width":"40.0px","styles":["filetype-pictures","result-filetype"]},"6283":{"childData":{"6416":{"expandRatio":1,"alignmentBitmask":33},"6284":{"expandRatio":0,"alignmentBitmask":5},"6287":{"expandRatio":0,"alignmentBitmask":5},"6286":{"expandRatio":0,"alignmentBitmask":34},"6289":{"expandRatio":0,"alignmentBitmask":5},"6288":{"expandRatio":0,"alignmentBitmask":33},"6294":{"expandRatio":0,"alignmentBitmask":5},"6290":{"expandRatio":0,"alignmentBitmask":33```,"6500":{"caption":"62,8 kB"},"6470":{"height":"32.0px","styles":["result-info-cell"]},"6474":{"caption":"77,2 kB"},"6473":{"caption":"15.07.2013 20:51"},"6472":{"styles":["document-owner-button"],"caption":"Developer Account"},"6471":{"styles":["document-file-name-button"],"caption":"10.jpg"},"6478":{"height":"30.0px","width":"40.0px","styles":["result-button-no-tag"]},"6477":{"height":"30.0px","width":"40.0px","styles":["result-button-no-sharing"]},"6476":{"height":"30.0px","width":"40.0px","styles":["result-button-list"]},"6475":{"height":"30.0px","styles":["result-icon-cell"]},"6479":{"height":"30.0px","width":"40.0px","styles":["result-button-no-comment"]},"6481":{"height":"30.0px","width":"40.0px","styles":["result-button-no-link"]},"6480":{"height":"30.0px","width":"40.0px","styles":["result-button-no-version"]},"6483":{"height":"32.0px","styles":["re
}}}

both times the json is 5052 chars long
vaadin-bot commented 11 years ago

Originally by CodingFabian


I know I am spammy, but I just pump in all the data i have. I just intercepted the atmosphere response which fails to parse. its 17k long, it ends unclean, and it has initial 8k of leading whitespace, then the messageid|for(;;)

vaadin-bot commented 11 years ago

Originally by CodingFabian


i want to packet sniff it, but no avail. it is only reproducable via https :-(

vaadin-bot commented 11 years ago

Originally by CodingFabian


correction. the number is not the messageid, but the supposed length.

 13876|for(;;);[{"ch

however when I look at the length of the message firebug got as response body, its 8995

vaadin-bot commented 11 years ago

Originally by CodingFabian


now this gets odd... I am in firebug when an exception occurs and have the source atmosphere jquery, rather than the compressed, so i can see the code. obviously the message is not complete. so trackMessageSize is used. and in my last comment the message size is listed as 13876. If i now break and have a look at the message it says : "3876|for(;;)" which clearly explains why the message is too short. in fact _trackMessageSize returns false, which is why the too short message is returned to the callback.

Next question: why is the 1 missing.

So I added console.log in line 1501 of jquery.atmosphere I logged the responseText, the lastIndex, and the length.

The first message that arrives is completely blank. 8192 spaces. lastIndex is 0, nextIndex is 8192

The second message that arrives is 8192 spaces, followed by an "1". The lastIndex is 8192, the nextIndex is "8193"

The third message which arrives starts with 8192 spaces and then 13876|... until its cut off, the json is not complete The lastIndex is 8193 next index is 17193

I would assume that the json goes on in the next message, but it is not processed. The reason is that in the second fragment there was the 1 from the message length. In the third fragement there was then an assumed length of 3876, which is completed, so the code stops.

i just wonder why I get the second fragment, which is just one char longer. Shouldn't it be directly appending the second 8192 chunk? why is it after the second only 8193.

Either that is buggy, or the _trackMessageSize needs to handle that the length of the message is cut in two chunks. Then 1212 needs to respect previous messages.

vaadin-bot commented 11 years ago

Originally by CodingFabian


by the way, in chrome. the first request has 3735 bytes, the second goes up to 8192 precisely, which leaves the next one to start exactly at the border for "13876|" parsing.

vaadin-bot commented 11 years ago

Originally by CodingFabian


the upload failure mystery is resolved. our uploads add some information to the ui when they are done and that information contained an "|". it seems that this still doesn't really work. I replaced that char and now uploads are ok. With regards to the splitting issue i have a hack which i am currently testing. I replaced AtmosphereRequestImpl and added a space to the response after it added the padding and flushed. first tests are promising.

vaadin-bot commented 11 years ago

Originally by @jdahlstrom


Nice work. So it seems that the trackMessageSize code doesn't take into account the situation where the message length itself gets split in two?

vaadin-bot commented 11 years ago

Originally by CodingFabian


yes. that is what is see. I don't know why it happens, and if there is a reliable way to prevent this. The 8k padding also looks like a hack for me. My assumption right now is that it is related to buffering. Atmosphere flushes the response after the padding has been written. Then the first char is written unbuffered, which causes the reponse to be flushed to the client. Before the next flush occurs the whole message has been written. So my so far working hack takes AtmosphereResourceImpl from vaadin atmosphere 14-beta3 and changed the write method to output a space after flush

    void write(boolean flushPadding) {

    if (beginCompatibleData == null) {
        beginCompatibleData = createStreamingPadding(padding);
    }

    try {
        if (useWriter && !((Boolean) req.getAttribute(ApplicationConfig.PROPERTY_USE_STREAM))) {
        try {
            response.getWriter();
        } catch (IllegalStateException e) {
            return;
        }

        if (flushPadding) {
            response.getWriter().write(beginCompatibleData);
        }
        response.getWriter().flush();
        response.getWriter().print(" ");
        } else {
        try {
            response.getOutputStream();
        } catch (IllegalStateException e) {
            return;
        }

        if (flushPadding) {
            response.getOutputStream().write(beginCompatibleData.getBytes());
        }
        response.getOutputStream().flush();
        response.getOutputStream().print(" ");
        }

    } catch (Throwable ex) {
        logger.warn("failed to write to response", ex);
    }
    }

so far this is only a hack, because i dont really understand why it happens. And why i can only see it under https. For that I assume right now that https has a different flushing behaviour of the response due to encryption. And why you might not see it, is because to be a problem, the initial response needs to be large so that it gets split up.

vaadin-bot commented 11 years ago

Originally by @jdahlstrom


AFAIK the initial padding is required for some browsers to reliably trigger onreadystatechange for incomplete AJAX responses so that the streaming can actually work.

vaadin-bot commented 11 years ago

Originally by CodingFabian


my hack doesnt work. I have a lengthy streaming response, and it can happen that in some point in time the _trackMessages length information is split into two message bursts.

It looks like track_messages always needs to consider the end of the previous message as well. Ill hack a patch...

vaadin-bot commented 11 years ago

Originally by CodingFabian


i fixed it :-)

indeed the problem is splitting the length information.

so for example processing had a message which like this:

45 }, "timings":[10721394, 2]}]5

because indexOf(delimited) did return -1, this "5" was not prepended to the next message

the following code is my patch for it, which detects this situation and makes sure the length is complete.

I will do a gerrit request asap and also report it to atmosphere.

function _trackMessageSize(message, request, response) {
    if (request.trackMessageLength) {

        // If we have found partial message, prepend them.
        if (response.partialMessage.length != 0) {
            message = response.partialMessage + message;
        }

        var messages = [];
        var messageLength = 0;
        var messageStart = message.indexOf(request.messageDelimiter);
        while (messageStart != -1) {
            messageLength = jQuery.trim(message.substring(messageLength, messageStart));
            message = message.substring(messageStart + request.messageDelimiter.length, message.length);

            if (message.length == 0 || message.length < messageLength) break;

            messageStart = message.indexOf(request.messageDelimiter);
            messages.push(message.substring(0, messageLength));
        }

        if (messages.length == 0 || (messageStart != -1 && message.length != 0 && messageLength != message.length)){
            if (messageStart == -1) {
                    // partial message is non message (e.g. length of next)
                    // it starts at the end of the last message
                    response.partialMessage = message.substring(messageLength);
                } else {
                    // it is a continuation of the last message
                    response.partialMessage =  messageLength + request.messageDelimiter + message;
                }
        } else {
            response.partialMessage = "";
        }

        if (messages.length != 0) {
            response.responseBody = messages.join(request.messageDelimiter);
            response.messages = messages;
            return false;
        } else {
            response.responseBody = "";
            response.messages = [];
            return true;
        }
    } else {
        response.responseBody = message;
    }
    return false;
}
vaadin-bot commented 11 years ago

Originally by CodingFabian


here the atmosphere ticket https://github.com/Atmosphere/atmosphere/issues/1199

vaadin-bot commented 11 years ago

Originally by CodingFabian


the bug fix is actually more appropriate for ticket http://dev.vaadin.com/ticket/12197, so i will comment it there and send pull request for that one

vaadin-bot commented 11 years ago

Originally by @jdahlstrom


So what's left in this ticket is the problem that IE doesn't allow creating iframes with HTTPS? It might indeed be best to fix that by enabling XDR - however, the XDR code path might need fixing to enable reliable disconnect/reconnect recovery, similar to what was done to the XHR streaming code.

vaadin-bot commented 11 years ago

Originally by CodingFabian


12197 need to be fixed to deal with the syntax error which can occur in all browsers using streaming.

This ticket originally was covering only the http conenct issue. as I have confirmed that the snytax issue is a different one, the fix I propose for HTTPs connect is to use a server relative url

vaadin-bot commented 11 years ago

Originally by @jdahlstrom


Ah, right. So does IE work even with the iframe approach (without XDR) if the push URL is relative?

vaadin-bot commented 11 years ago

Originally by CodingFabian


that is my current assumption. because this ticket is already scheduled for 7.1.2 id did not prioritize testing. but it is what i will be rolling out next week when I upgrade centerdevice.de to 7.1.1

vaadin-bot commented 11 years ago

Originally by @jdahlstrom


Sorry for the delay, finally got around to test IE with HTTPS. I was able to reproduce the SEC7111 error on IE9, but push seems to work anyway. IE8 works fine as well. The error message is ugly, but this doesn't appear to be a critical issue anymore; the actual problem seems to have been #12197?

If you have an application where push with IE is actually broken because of this, please describe steps to reproduce.