Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

ipfs.cat calls https://node{0..3}.preload.ipfs.io/api/v0/refs?r=true&arg=<hash> on every cat #3307

@georgyo

Description

@georgyo
  • Version:
{version: "0.50.1", repo: 9, commit: "", interface-ipfs-core: "^0.140.0", ipfs-http-client: "^47.0.0"}
  • Platform:
    Verified in Firefox 81 and Chrome 85 on Windows, Linux, and Macos

  • Subsystem:
    Unknown

Severity:

Medium

Description:

If there are many repeat calls of ipfs.cat on subpaths of a IPFS hash, then each cat will call refs on the root of the hash. The calls are identical, and they don't seem to end up the browser's indexdb, or at least they aren't referenced there again.

On large trees, you could end up downloading many gigabytes of the same refs exact refs data.

Steps to reproduce the error:

I discovered this while sending over improvements to moshisushi/hlsjs-ipfs-loader

If you look at the network requests made on https://charade.fu.io you will see hundreds of requests to the following 4 URLS.

https://node0.preload.ipfs.io/api/v0/refs?r=true&arg=QmbdmJ2JRvEFhWWzHKrAcjjBdkcs46F2N7ggZnrdKKAu4s
https://node1.preload.ipfs.io/api/v0/refs?r=true&arg=QmbdmJ2JRvEFhWWzHKrAcjjBdkcs46F2N7ggZnrdKKAu4s
https://node2.preload.ipfs.io/api/v0/refs?r=true&arg=QmbdmJ2JRvEFhWWzHKrAcjjBdkcs46F2N7ggZnrdKKAu4s
https://node3.preload.ipfs.io/api/v0/refs?r=true&arg=QmbdmJ2JRvEFhWWzHKrAcjjBdkcs46F2N7ggZnrdKKAu4s

There are 1360 parts times 5 different bit rates, and each part cat also triggers ipfs-js to call that refs api for the entire tree, not just for that part. The refs here are 2.5MB. As a result the browser is downloading more than 3.5GB of the same 2.5MB from the preload servers.

The movie Charade (1963) is in the Public Domain, I'm using it as a much longer Big Buck Bunny to enhance the issue. There is no copyright infringement there.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P0Critical: Tackled by core team ASAPkind/bugA bug in existing code (including security flaws)status/in-progressIn progress

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions