Skip to content

trickle.py is broken #10208

Open
Open

Description

@annevk

While playing around with something today I noticed that trickle.py (nested in xhr/ and fetch/ somewhere) doesn't actually flush and instead waits for EOF before sending the content.

You can make it flush by increasing the chunk, e.g., chunk * 100.

We should make that change and see how it affects the test results.

Activity

  1. jgraham commented on Mar 28, 2018

    @jgraham
    Contributor

    FWIW you might be better off using the trickle pipe i.e. load a resource with something like ?pipes=trickle(10:d2:r2) meaning "Send 10 bytes, wait 2s, repeat the previous two steps until the resource is fully sent"

  2. annevk commented on Mar 28, 2018

    @annevk
    MemberAuthor

    That might be interesting. I also now wonder if what I observed was instead an HTML parser thingy and not a server thingy. Where the HTML parser wants at least a 1000 bytes or so.

  3. jgraham commented on Mar 28, 2018

    @jgraham
    Contributor

    Yeah, it looks like flush() is called implicitly unless you disabled that, so I think the code as written should work.

  4. zcorpan commented on Apr 19, 2018

    @zcorpan
    Member

    So this bug affects these 11 tests:

    $ grep -r "trickle.py" .
    ./xhr/firing-events-http-content-length.html:        xhr.open("GET", "resources/trickle.py?ms=0&count=100&specifylength=1", true);
    ./xhr/firing-events-http-no-content-length.html:        xhr.open("GET", "resources/trickle.py?ms=0&count=100", true);
    ./xhr/send-timeout-events.htm:            xhr.open("POST", "./resources/trickle.py", true);
    ./xhr/response-data-progress.htm:async_test(function () { doTest(this, false, 0, "resources/trickle.py?count=6&delay=150"); },
    ./xhr/response-data-progress.htm:async_test(function () { doTest(this, true, 78, "resources/trickle.py?count=6&delay=150&specifylength=1"); },
    ./xhr/event-loadstart-upload.htm:    client.open("POST", "resources/trickle.py?ms=5&count=8");
    ./xhr/event-readystatechange-loaded.htm:    client.open("GET", "resources/trickle.py?count=10"); // default timeout in trickle.py is 1/2 sec, so this request will take 5 seconds to complete
    ./xhr/event-progress.htm:    client.open("GET", "resources/trickle.py?count=4&delay=150");
    ./fetch/api/response/response-cancel-stream.html:    return fetch(RESOURCES_DIR + "trickle.py?ms=30&count=100").then(function(response) {
    ./fetch/api/response/response-cancel-stream.html:    return fetch(RESOURCES_DIR + "trickle.py?ms=30&count=100").then(function(response) {
    ./fetch/api/response/response-clone.html:        return fetch('../resources/trickle.py?count=2&delay=100').then(function(res) {
    ./fetch/api/response/response-clone.html:        return fetch('../resources/trickle.py?count=2&delay=100').then(function(res) {
    ./fetch/api/basic/stream-response.any.js:  return fetch(RESOURCES_DIR + "trickle.py?ms=30&count=100").then(function(resp) {
    ./fetch/api/request/request-keepalive-quota.html:            // the effects of a rolling quota. To do this we will utilize trickle.py with a 1s delay. This should
    ./fetch/api/request/request-keepalive-quota.html:            const trickleURL = '../resources/trickle.py?count=1&ms=';
    

    The HTML parser waiting for 1024 bytes or encoding declaration sounds plausible but I haven't tested to confirm that is what is happening here...

  5. zcorpan commented on Apr 19, 2018

    @zcorpan
    Member

    On irc

    wanderview zcorpan: while trying to get around the parser wait in firefox I also had to make sure the response had a Content-Type header... not sure if that impacts you
    wanderview Content-Type: text/html
    
  6. annevk commented on Apr 24, 2018

    @annevk
    MemberAuthor

    Adding ;charset=UTF-8 definitely changes things in Firefox when loading this in a browsing context, but Chrome doesn't seem to be affected and doesn't display anything faster.

    It probably doesn't affect any of the 11 tests above though, even though they could use some improvements...

  7. annevk commented on Apr 24, 2018

    @annevk
    MemberAuthor

    It seems to affect Chrome for xhr/response-data-progress.htm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions