Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(fetch): hangs on a stream response with manual redirect #1627

Merged
merged 1 commit into from Aug 30, 2022

Conversation

feugy
Copy link
Contributor

@feugy feugy commented Aug 30, 2022

πŸ“– What's in there?

We found out that fetch() hangs when consuming the stream body of a redirect, when { redirect: 'manual' } is set.
Full discussion: #1618

πŸ§ͺ How to test?

It's covered with unit test: npm run test:fetch
Without the fix, you'll see a new test failing like this:

 FAIL  test/fetch/client-fetch.js
 βœ– terminated

        fetchParams.controller.controller.error(
          new TypeError('terminated', {
----------^
            cause: isErrorLike(reason) ? reason : undefined
          })

  test: redirect with stream
  stack: |
    Fetch.onAborted (lib/fetch/index.js:1913:11)
    Fetch.terminate (lib/fetch/index.js:83:10)
    Object.onError (lib/fetch/index.js:2061:36)
    Request.onError (lib/core/request.js:265:27)
    errorRequest (lib/client.js:1722:13)
    Object.abort (lib/client.js:1335:7)
    Object.destroy (lib/fetch/index.js:1571:21)
    httpFetch (lib/fetch/index.js:1066:41)
  at:
    line: 1913
    column: 11
    file: lib/fetch/index.js
    function: Fetch.onAborted
  type: TypeError
  tapCaught: unhandledRejection

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@KhafraDev KhafraDev merged commit 89a340f into nodejs:main Aug 30, 2022
metcoder95 pushed a commit to metcoder95/undici that referenced this pull request Dec 26, 2022
crysmags pushed a commit to crysmags/undici that referenced this pull request Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants