Skip to content

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

@ukstv

Description

@ukstv

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    need/triageNeeds initial labeling and prioritization

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions