Visitar URL original
test/client-request.js, 'request dump' test case always takes ~ 5 seconds · Issue #3120 · nodejs/undici · GitHub
Skip to content

test/client-request.js, 'request dump' test case always takes ~ 5 seconds #3120

Closed

Description

@Uzlopak

Is there a reason, that 'request dump' takes 5 seconds but 'request dump big' just 30ms. Also I doubt that 'request dump big' is correctlly written, as it just sends data till reaching the highwatermark.

So the 5 seconds are kind of fishy. Maybe it keeps the connection open for some reason open? Maybe Maybe an indicator for a bug?

Activity

  1. Uzlopak commented on Apr 15, 2024

    @Uzlopak
    ContributorAuthor

    The same with 'request DELETE, content-length=0, with body' in test/content-length.js

  2. Uzlopak commented on Apr 17, 2024

    @Uzlopak
    ContributorAuthor

    I investigated it further. The tests will run faster if I manually set shouldKeepAlive to false.

    I guess this is also related to issue-803, as it never sending the whole payload to the client.

    Also i have the fealing that contentLenght is not stored properly as an attribute . It is set as empty string. The numbers are added.

  3. mweberxyz commented on Apr 18, 2024

    @mweberxyz
    Contributor

    Dunno if relevant, but if you call dump({ limit: 4 }) (or any number less than the Content-Length) in the test it'll also finish right away.

  4. Uzlopak commented on Apr 18, 2024

    @Uzlopak
    ContributorAuthor

    If you set the dump limit to 4, then it will result in an error, which gets passed to noop. Thats why it is finishing early.

  5. mweberxyz commented on Apr 18, 2024

    @mweberxyz
    Contributor

    Seems working as expected then if I am understanding everything correctly. If dump is able to consume the entire response, then the socket is clear for another request, and the client's disconnect event won't fire until the keep alive timeout.

    For 'request dump', would it be preferable to replace

        client.on('disconnect', () => {
          t.strictEqual(dumped, true)
        })
    

    with

        client.on('drain', () => {
          setImmediate(() => t.strictEqual(dumped, true))
        })
    

    ?

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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions