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

Next 13.4: Error: connect ETIMEDOUT ::1:50720 at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1494:16) #51560

Closed
1 task done
broksonic21 opened this issue Jun 20, 2023 · 7 comments
Labels
bug Issue was opened via the bug report template. locked

Comments

@broksonic21
Copy link

broksonic21 commented Jun 20, 2023

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
      Platform: darwin
      Arch: arm64
      Version: Darwin Kernel Version 22.5.0: Mon Apr 24 20:52:24 PDT 2023; root:xnu-8796.121.2~5/RELEASE_ARM64_T6000
    Binaries:
      Node: 18.16.0
      npm: 9.7.1
      Yarn: N/A
      pnpm: N/A
    Relevant packages:
      next: 13.4.7-canary.1
      eslint-config-next: 13.4.4
      react: 18.2.0
      react-dom: 18.2.0
      typescript: 5.1.3

Which area(s) of Next.js are affected? (leave empty if unsure)

No response

Link to the code that reproduces this issue or a replay of the bug

npx create-next-app -e reproduction-template --- no change needed

To Reproduce

We can reproduce this in our environment, but also directly against npx create-next-app -e reproduction-template --- no change needed to see this. Happens after 5000 or 6000 every time.

npm run build
npm start

Then in a new window:

ab -n 10000 -c 100 http://127.0.0.1:3000/

Describe the Bug

In Next 13.3 - we can run

ab -n 10000 -c 100 http://127.0.0.1:3000/

to completion without error

But on 13.4 (including in canary), we get :

~ ab -n 10000 -c 100 http://127.0.0.1:3000/
This is ApacheBench, Version 2.3 <$Revision: 1903618 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 127.0.0.1 (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
apr_socket_recv: Operation timed out (60)
Total of 6455 requests completed

As well as this from the server - it never recovers once in this state.

> next start

- ready started server on 0.0.0.0:3000, url: http://localhost:3000
Error: connect ETIMEDOUT 127.0.0.1:57665
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1494:16) {
  errno: -60,
  code: 'ETIMEDOUT',
  syscall: 'connect',
  address: '127.0.0.1',
  port: 57665
}
Error: connect ETIMEDOUT 127.0.0.1:57665
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1494:16) {
  errno: -60,
  code: 'ETIMEDOUT',
  syscall: 'connect',
  address: '127.0.0.1',
  port: 57665
}

The error then repeats forever until you kill the server.

Expected Behavior

Next 13.4 (or canary) runs same as 13.3 - you can run multiple calls vs it without crash

Which browser are you using? (if relevant)

ab

How are you deploying your application? (if relevant)

next start (seen in production docker as well as local setup)

@broksonic21 broksonic21 added the bug Issue was opened via the bug report template. label Jun 20, 2023
@broksonic21
Copy link
Author

This does not repro when using:

  experimental: {
    appDir: false 
    // https://nextjs.org/docs/messages/experimental-app-dir-config
    // this also controls running workers https://github.com/vercel/next.js/issues/45508#issuecomment-1597087133, which is causing
    // memory issues in 13.4.4 so until that's fixed, we don't want this.
  },

I can run forever in this mode.

@broksonic21
Copy link
Author

#49929 (comment) has my notes on how this also impacts memory.

@mauron85
Copy link

for me it happens even for very first request in 13.4

@mircostraessle
Copy link

We were able to fix this issue on our system thanks to this comment #49929 (comment) which mentioned, that the new Next.js Setup now uses multiple processes to work.
That got us thinking and we found out, that on our company infrastructure there was a global http proxy configured and because there was no exception in the proxy configuration for localhost the communication between these Next.js processes was routed through the proxy which obviously didn't work and caused the timeout errors.

adamrhunter added a commit to adamrhunter/next.js that referenced this issue Jul 16, 2023
The docs at https://nextjs.org/docs/pages/building-your-application/configuring/mdx have been (correctly) changed to use `metadata` as the exported variable holding metadata (see vercel#51560 ).   However, the example layout component (MyLayoutComponent) uses the `metadata` value via its `meta` prop, so the prop's value should be renamed from `meta` to `metadata`
@broksonic21
Copy link
Author

broksonic21 commented Aug 2, 2023

It seems better recently, but still crashes on:

ab -n 100000 -c 100 http://127.0.0.1:3000/

And the memory grows but is never relinquished. I still have:

image

After a crash:
image

Even after ctrl-c the server, the memory stays up and is running. I have to kill -9 to kill it.

<Mentioned here: #49929 (comment) >

@broksonic21
Copy link
Author

This has been resolved - see #49929 (comment) for notes. Closing this one out as I no longer see this as an active issue that needs addressing.

@github-actions
Copy link
Contributor

github-actions bot commented Sep 8, 2023

This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot added the locked label Sep 8, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template. locked
Projects
None yet
Development

No branches or pull requests

3 participants