-
Notifications
You must be signed in to change notification settings - Fork 89
Trie.prototype._updateNode(); TypeError: Cannot read property 'pop' of undefined #12
Comments
@Ryanmtate do you have the code that generates this error? |
I've seen this a bunch with the TestRPC. Was too intermittent to figure out the root cause however. |
This problem still exists with TestRPC, I've spent a few hours trying to track down how to fix it, but so far haven't figured out how. Callback hell... I've tried making it pass an error in the callback from Giving up for now, might look at it again later if I have time. But I'm documenting my findings below if anyone else has the patience: The symptoms start with this line in walkController.only(branchIndex) which then runs this function only: function (childIndex) {
var childRoot = node.getValue(childIndex)
self._lookupNode(childRoot, function (node) { // node is undefined here
var childKey = key.slice()
childKey.push(childIndex)
processNode(childRoot, node, childKey, cb)
})
} In the recursive call for processNode from above it calls this line if (!node) return cb() <-- no arguments this is cb from above if (err) {
return onDone(err)
}
// returnValues is an empty array from the walkTrie closure, so essentially onDone()
onDone.apply(null, returnValues) onDone from above is the callback in self._findPath(key, function (err, foundValue, keyRemainder, stack) {
// all arguments here are undefined because it gets called with no arguments
if (err) {
return cb(err);
}
// then update
// this call crashes the program because stack is undefined
self._updateNode(key, value, keyRemainder, stack, cb)
}) |
Will cautiously close this since the issue is pretty old, there hasn't been any reports lately and the code base changed significantly since. There has also been a refactor of the |
_updateNode is receiving undefined stack
Receiving TypeError: Cannot read property 'pop' of undefined
Suspect WalkController is not passing stack in the callback of processNode();
The text was updated successfully, but these errors were encountered: