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

analytics-node does not close HTTPS connection on closeAndFlush #1052

Closed
nferch opened this issue Mar 18, 2024 · 2 comments
Closed

analytics-node does not close HTTPS connection on closeAndFlush #1052

nferch opened this issue Mar 18, 2024 · 2 comments

Comments

@nferch
Copy link

nferch commented Mar 18, 2024

closeAndFlush() does not close the HTTPS connection to the Segment API:

Leaked resources 0:
[WTF Node?] open handles:
- File descriptors: (note: stdio always exists)
  - fd 2 (tty) (stdio)
  - fd 1 (tty) (stdio)
  - fd 0 (tty)
- Sockets:
  - XX.XX.XX.XX:61342 -> 52.12.47.65:443
@silesky
Copy link
Contributor

silesky commented Mar 19, 2024

@nferch thanks for taking out an issue.

Confirming:

  • Are you using the ambient fetch from the environment, or a custom one / http client override?

I'd have to think on this / repro. This is a bit of a head scratcher that there are open sockets, because there is no open handles -- and IME, pending fetch requests get reflected as callbacks on the event loop.

Weeeird 😅

@silesky
Copy link
Contributor

silesky commented Mar 25, 2024

@nferch I reprod this -- the socket shows clear, but it might take until the next event loop.

await analytics.closeAndFlush()
setImmediate(() => wtf.dump())

results in no open sockets:

// [WTF Node?] open handles:
- File descriptors: (note: stdio always exists)
  - fd 2 (tty) (stdio)
  - fd 1 (tty) (stdio)

@silesky silesky closed this as completed Mar 25, 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

No branches or pull requests

2 participants