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

Bug: Too much event listeners attached to an AbortSignal #274

Open
ukstv opened this issue May 5, 2023 · 4 comments
Open

Bug: Too much event listeners attached to an AbortSignal #274

ukstv opened this issue May 5, 2023 · 4 comments
Labels
need/triage Needs initial labeling and prioritization

Comments

@ukstv
Copy link

ukstv commented May 5, 2023

Let's assume you call ipfs.dag.get(cid, '/s/o/m/e/v/e/r/y/l/o/n/g/p/a/t/h', {signal: abortSignal}) where ipfs is an IPFS HTTP Client. The control flow would eventually go to ipfs-http-client resolve function, and then end up in src/http.js fetch function of this package.

Every path element would add an event listener to the original abortSignal. Eventually, if the path is long enough, Node.js starts emitting MaxListenersExceededWarning warnings. I consider this a bug.

Now any-signal library allows you to clear event listeners after use. The solution to the warnings problem might be to call signal.clear after response is done. I would happily contribute, yet any-signal can not really be used here due to CJS/ESM incompatibility: You can not use ESM any-signal from CJS js-ipfs-utils package. See also: #266

@ukstv ukstv added the need/triage Needs initial labeling and prioritization label May 5, 2023
@welcome
Copy link

welcome bot commented May 5, 2023

Thank you for submitting your first issue to this repository! A maintainer will be here shortly to triage and review.
In the meantime, please double-check that you have provided all the necessary information to make this process easy! Any information that can help save additional round trips is useful! We currently aim to give initial feedback within two business days. If this does not happen, feel free to leave a comment.
Please keep an eye on how this issue will be labeled, as labels give an overview of priorities, assignments and additional actions requested by the maintainers:

  • "Priority" labels will show how urgent this is for the team.
  • "Status" labels will show if this is ready to be worked on, blocked, or in progress.
  • "Need" labels will indicate if additional input or analysis is required.

Finally, remember to use https://discuss.ipfs.io if you just need general support.

@avious00
Copy link

avious00 commented May 5, 2023

+1 we've seen this become a developer experience pain point - several forum and discord posts on this, e.g. [1] [2] [3]

@avious00
Copy link

avious00 commented May 5, 2023

@achingbrain you helped us on the anysignal portion, can we do it again? :D

@avious00
Copy link

hi @achingbrain - we're still seeing errors from this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need/triage Needs initial labeling and prioritization
Projects
None yet
Development

No branches or pull requests

2 participants