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: don't add listeners to the same signal more than once #3174

Closed

Conversation

tsctx
Copy link
Contributor

@tsctx tsctx commented Apr 28, 2024

No description provided.

@codecov-commenter
Copy link

codecov-commenter commented Apr 28, 2024

Codecov Report

Attention: Patch coverage is 93.75000% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 94.16%. Comparing base (24f7ee6) to head (5009498).

Files Patch % Lines
lib/api/abort-signal.js 93.75% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3174      +/-   ##
==========================================
- Coverage   94.16%   94.16%   -0.01%     
==========================================
  Files          90       90              
  Lines       24385    24407      +22     
==========================================
+ Hits        22962    22982      +20     
- Misses       1423     1425       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tsctx tsctx force-pushed the fix/do-not-add-listerners-same-signal branch from b97aa2c to 948d332 Compare April 28, 2024 07:03
@ronag
Copy link
Member

ronag commented Apr 28, 2024

What is this solving?

@tsctx
Copy link
Contributor Author

tsctx commented Apr 28, 2024

#3131

@Uzlopak
Copy link
Contributor

Uzlopak commented Apr 28, 2024

But isnt it a bug in the elasticsearch client too, that it tries to add again and again the same listeners? Not saying we should not solve it here. But now it hints to a bug, but after we merge this you dont get a hint that something is wrong.

@ronag
Copy link
Member

ronag commented Apr 28, 2024

I don't think we should merge this. It doesn't solve an actual bug. It just bypasses the warning.

Copy link
Member

@ronag ronag left a comment

Choose a reason for hiding this comment

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

Se above

@tsctx
Copy link
Contributor Author

tsctx commented Apr 28, 2024

But isnt it a bug in the elasticsearch client too, that it tries to add again and again the same listeners?

elasticsearch client is not the cause of the problem, it is undici-specific. In fact, it does not leak.

Not saying we should not solve it here. But now it hints to a bug, but after we merge this you dont get a hint that something is wrong.

When a signal was given and a large number of requests were sent at once (easy to see in the test), listeners were added more than the limit and a warning was generated.

@metcoder95
Copy link
Member

Not saying we should not solve it here. But now it hints to a bug, but after we merge this you dont get a hint that something is wrong.

When a signal was given and a large number of requests were sent at once (easy to see in the test), listeners were added more than the limit and a warning was generated.

I am not sure if we should consider that an undici problem. This issue is potentially everywhere and it seems we are trying to protect the users from themselves when they should be aware of how they handle their signals and others.
No strong opinion on this, but I'd advise considering if worth the complexity given this is more a problem of how is AbortSignal used by the user rather than by undici.

@tsctx
Copy link
Contributor Author

tsctx commented Apr 28, 2024

Oh, you are right.

@tsctx tsctx closed this Apr 28, 2024
@tsctx tsctx deleted the fix/do-not-add-listerners-same-signal branch April 28, 2024 09:11
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

5 participants