Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: remove tracked download resources to avoid erroneous double-releases #21

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pfrazee
Copy link
Contributor

@pfrazee pfrazee commented May 28, 2021

In my ctzn tests, I had remote hyperbees throw the following error during a hypercore .close():

/Users/paulfrazee/work/ctzn/node_modules/@hyperspace/rpc/index.js:11
    const err = new Error(message)
                ^

Error: Invalid resource: 12628
    at Object.decode (/Users/paulfrazee/work/ctzn/node_modules/@hyperspace/rpc/index.js:11:17)
    at RPC._onmessage (/Users/paulfrazee/work/ctzn/node_modules/arpeecee/index.js:113:33)
    at Parser._nextState (/Users/paulfrazee/work/ctzn/node_modules/arpeecee/parser.js:127:14)
    at Parser._readMessage (/Users/paulfrazee/work/ctzn/node_modules/arpeecee/parser.js:54:19)
    at Parser.recv (/Users/paulfrazee/work/ctzn/node_modules/arpeecee/parser.js:35:44)
    at RPC._write (/Users/paulfrazee/work/ctzn/node_modules/arpeecee/index.js:170:22)
    at WritableState.update (/Users/paulfrazee/work/ctzn/node_modules/streamx/index.js:168:14)
    at updateWriteNT (/Users/paulfrazee/work/ctzn/node_modules/streamx/index.js:479:6)
    at processTicksAndRejections (node:internal/process/task_queues:82:21) {
  code: '',
  errno: 0,
  details: ''
}

I tracked this down to the deleteResource() calls which were releasing active downloads. Turns out completed downloads were not being removed from the set of tracked download-resources, leading to this error due to a double-release.

The PR fixes this by removing a completed download from the set.

@pfrazee pfrazee requested a review from andrewosh May 28, 2021 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant