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

add test for live pull-stream #76

Merged
merged 2 commits into from Jun 28, 2022
Merged

add test for live pull-stream #76

merged 2 commits into from Jun 28, 2022

Conversation

staltz
Copy link
Member

@staltz staltz commented Jun 28, 2022

Context

Sometimes in Manyverse upon closing the app I would get the error below, but today I also got this error in some test code in ssb-db2, and that finally allowed me to debug it easily.

Uncaught Exception at  uncaughtException : Error: async-append-only-log stream is closed
    at streamClosedErr (./node_modules/async-append-only-log/errors.js:46:10)
    at closeAfterDeletesFlushed (./node_modules/async-append-only-log/index.js:517:57)
    at onDeletesFlushed (./node_modules/async-append-only-log/index.js:308:42)
    at closeAfterHavingDrained (./node_modules/async-append-only-log/index.js:516:7)
    at onDrain (./node_modules/async-append-only-log/index.js:536:67)
    at close (./node_modules/async-append-only-log/index.js:515:5)
    at Object.waitForLogLoaded [as close] (./node_modules/async-append-only-log/index.js:527:12)
    at ./db.js:663:11
    at ./node_modules/multicb/index.js:41:13
    at ./node_modules/levelup/lib/levelup.js:142:16

Problem

As you can see, it's the streamClosedErr from AAOL, but what's puzzling is that this error is only used when closing the AAOL, it's sent to stream.abort(). But the push-stream implementation we have doesn't throw that error anywhere.

Finally, I realized that this throwing happens somewhere in the pull-stream stack. We have live log streams that are converted to pull-stream.

Solution

1st ❌ 2nd ✔️

Just abort with true. I don't see a real need to have the abortion as an actual Error, since in this case we just want to cancel the live streams and close() AAOL.

@staltz staltz requested a review from arj03 June 28, 2022 16:17
Copy link
Member

@arj03 arj03 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice find 👍

@staltz staltz merged commit 869133a into master Jun 28, 2022
@staltz staltz deleted the live-abort-pull-stream branch June 28, 2022 17:31
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.

None yet

2 participants