Skip to content

boxo/blockstore: failing to parse keysΒ #293

@m0ar

Description

@m0ar

Hi πŸ‘‹

Problem

We are using [email protected] bundled/built into [email protected], but are seeing consistent failures in everything that is using AllKeysChan. It prevents reprovide from being functional, as well as all other block listing operations like ipfs repo ls.

These errors are logged at a very high speed every time that happens:

{"level":"warn","ts":"2024-11-29T10:35:13.118Z","logger":"blockstore","caller":"blockstore/blockstore.go:298","msg":"error parsing key from binary: illegal base32 data at input byte 4"}
{"level":"warn","ts":"2024-11-29T10:35:13.118Z","logger":"blockstore","caller":"blockstore/blockstore.go:298","msg":"error parsing key from binary: illegal base32 data at input byte 4"}
{"level":"warn","ts":"2024-11-29T10:35:13.118Z","logger":"blockstore","caller":"blockstore/blockstore.go:298","msg":"error parsing key from binary: illegal base32 data at input byte 4"}
{"level":"warn","ts":"2024-11-29T10:35:13.118Z","logger":"blockstore","caller":"blockstore/blockstore.go:298","msg":"error parsing key from binary: illegal base32 data at input byte 4"}

The source of the error is this check in boxo/blockstore.go (v0.15.0 for [email protected]): https://github.com/ipfs/boxo/blob/v0.15.0/blockstore/blockstore.go#L296-L300

This is quite bad as it prevents the node from being a useful network participant. While it can serve most direct queries, it prevents efficient content discovery from other peers.

It seems related to #198, as this has the same failure mode. (cc @Stebalien @obo20 )
Not sure if fcbd2ef alone would do the trick, or if it relies on other changes in that branch? πŸ€”

Analysis

We have a few other nodes running [email protected] with [email protected], that show the same issues, but on byte 6 instead:

error parsing key from binary: illegal base32 data at input byte **6**

Given those two datapoint, I suspect it's choking on the rootDirectory being included in the response when comparing the datastore specs. The node erroring out at byte 4 has rootDirectory: "ipfs", and the other has desci-s3-public-ipfs-production. When looking at the S3 paths, I think it chokes on special chars in the path, but this shouldn't happen as boxo should only be getting the naked flatfs keys:

ipfs/CIQA2274WAKEDP4ICBKMSTA5QHDI63OA4NM25GJELROEKYZMBC2QGNI
1234⬆

public-ceramic-ipfs-dev-1/CIQA222FAE4B3WMWDZ5DJU5EKE32XMA2GNJDHEBE7SKG5VIYMAYYQXA
123456⬆
Datastore specs πŸ‘ˆ (click to expand)
// [email protected] + [email protected]
"Spec": {
  "mounts": [
    {
      "child": {
        "accessKey": "LEAKED",
        "bucket": "desci-s3-public-ipfs-production",
        "region": "us-east-2",
        "rootDirectory": "ipfs",
        "secretKey": "LEAKED",
        "type": "s3ds"
      },
      "mountpoint": "/blocks",
      "prefix": "s3.datastore",
      "type": "measure"
    },
    {
      "child": {
        "compression": "none",
        "path": "datastore",
        "type": "levelds"
      },
      "mountpoint": "/",
      "prefix": "leveldb.datastore",
      "type": "measure"
    }
  ],
  "type": "mount"
},
// [email protected] + [email protected]
"Spec": {
  "mounts": [
    {
      "child": {
        "accessKey": "[redacted]",
        "bucket": "public-ceramic-ipfs-dev",
        "region": "us-east-2",
        "rootDirectory": "public-ceramic-ipfs-dev-1",
        "secretKey": "[redacted]",
        "type": "s3ds"
      },
      "mountpoint": "/blocks",
      "prefix": "s3.datastore",
      "type": "measure"
    },
    {
      "child": {
        "compression": "none",
        "path": "datastore",
        "type": "levelds"
      },
      "mountpoint": "/",
      "prefix": "leveldb.datastore",
      "type": "measure"
    }
  ],
  "type": "mount"
},

Questions

  1. Is there any workaround we can use?
  2. Can this be solved by merging fcbd2ef from Fix query logicΒ #39 ?
  3. Is this solved in later versions of this plugin?
  4. In general, do we need to be particularly careful when upgrading kubo when using this plugin? Are there points in the kubo release history that require particular migration steps for this datastore?

Metadata

Metadata

Assignees

No one assigned

    Labels

    need/author-inputNeeds input from the original authorneed/triageNeeds initial labeling and prioritization

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions