ssbc / ssb-db

A database of unforgeable append-only feeds, optimized for efficient replication for peer to peer protocols
https://scuttlebot.io/
MIT License
1.17k stars 75 forks source link

test/close.js fail #290

Closed christianbundy closed 4 years ago

christianbundy commented 4 years ago

Problem: I think #284 introduced a regression where test/close.js doesn't pass anymore.

Solution: I started trying to fix this with #288 but my quick-fix didn't work.

christianbundy commented 4 years ago

I took the scenic route, tracing the problem through SSB-DB → FlumeView-Level → FlumeDB, with a few extra stops along the way, but I've finally traced it back to this line:

https://github.com/ssbc/ssb-db/blob/4bec45a40664bf958af4b17dd0143ad2abb14a69/minimal.js#L22

Removing wait() unbreaks the code, but I don't completely understand what the behavior of AsyncJobQueue is meant to be or what the consequences of changing it would be. My understanding is that some unboxers need to wait for special 'setup' functions to get keys and such, but it seems like the non-setup job is never being executed. Here's a trace from fa34652dd1a15dd41bd5ea95799d31c75e7bc207:

Trace: This is where unboxerMap() goes into a queue. It is never seen again.
    at Array.<anonymous> (/home/christianbundy/src/ssb-db/minimal.js:62:17)
    at chainMaps (/home/christianbundy/src/ssb-db/minimal.js:33:14)
    at /home/christianbundy/src/ssb-db/node_modules/flumedb/index.js:70:14
    at /home/christianbundy/src/ssb-db/node_modules/flumelog-offset/inject.js:93:9
    at /home/christianbundy/src/ssb-db/node_modules/flumelog-offset/frame/recoverable.js:48:11
    at /home/christianbundy/src/ssb-db/node_modules/aligned-block-file/blocks.js:75:11
    at get (/home/christianbundy/src/ssb-db/node_modules/aligned-block-file/blocks.js:29:7)
    at next (/home/christianbundy/src/ssb-db/node_modules/aligned-block-file/blocks.js:53:7)
    at Object.read (/home/christianbundy/src/ssb-db/node_modules/aligned-block-file/blocks.js:78:7)
    at next (/home/christianbundy/src/ssb-db/node_modules/flumelog-offset/frame/recoverable.js:47:16)
mixmix commented 4 years ago

@christianbundy is this now resolved?

christianbundy commented 4 years ago

Yup!