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

Support Node.js v19 #4350

Closed
wants to merge 2 commits into from
Closed

Conversation

RafaelGSS
Copy link
Member

Apparently, the semver-major that affects Fastify is only nodejs/node#43522.

However, it's leading to some weird inconsistencies. The remaining failing tests are:

  • test/close-pipelining.test.js
  • test/close.test.js

I did a quick investigation and looks like the original behaviour of graceful shutdown has changed. For instance, the following snippet is not returning 503 for the second request as expected:

  const fastify = Fastify({
    return503OnClosing: true,
    forceCloseConnections: false
  })

  fastify.get('/', (req, reply) => {
    // once it's called, the next request will throw a `UND_ERR_SOCKET` even trying to reutilize the connection
    fastify.close() 
    reply.send({ hello: 'world' })
  })

  fastify.listen({ port: 0 }, async err => {
    t.error(err)

    const instance = new Client('http://localhost:' + fastify.server.address().port, {
      pipelining: 1
    })

    const codes = [200, 503]
    for (const code of codes) {
      // the first request works fine
      // the second request throws UND_ERR_SOCKET
      instance.request(
        { path: '/', method: 'GET' }
      ).then(data => {
        t.equal(data.statusCode, code)
      }).catch((e) => {
        t.fail(e)
      })
    }
    instance.close(() => {
      t.end('Done')
    })
  })

cc: @ShogunPanda

@github-actions github-actions bot added the test Issue or pr related to our testing infrastructure. label Oct 17, 2022
@github-actions github-actions bot removed the test Issue or pr related to our testing infrastructure. label Oct 17, 2022
@mcollina
Copy link
Member

I have a feeling this might be a bug in Undici: nodejs/undici#1670.

Undici is closing the socket early even if there is more data to process.

@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants