hypercore-protocol / hypercore-next

Hypercore 10 is an append only log with multi-writer primitives built in.
MIT License
150 stars 15 forks source link

hit this today #70

Open mafintosh opened 2 years ago

mafintosh commented 2 years ago

/home/ubuntu/hypermirror/node_modules/hypercore/lib/replicator.js:443 this.upgrading.resolve() ^

TypeError: Cannot read property 'resolve' of null at RequestPool._onupgrade (/home/ubuntu/hypermirror/node_modules/hypercore/lib/replicator.js:443:20) at async Replicator.ondata (/home/ubuntu/hypermirror/node_modules/hypercore/lib/replicator.js:805:7)

Octalbyte commented 2 years ago

@mafintosh

this.upgrading is null unless one of two specific lines are run. There are lines 319 and 379. 319 is inside the function _updateUpgrade. I think the error might be in 379. The two lines above it have the comment:

// TODO: if the peer fails, we need to resolve the promise as well woop woop
// so we need some tracking mechanics for upgrades in general.

My guess is something went wrong with 1) The UpgradeLock constructor. But I can't really think of a way a constructor so simple my run into an error and return null. 2) The conditions to set this.upgrading, which are in lines 318 and 362-390 (a lot of TODO notes in that area).

Is there a way to replicate the error?