ssbc / ssb-db2

A new database for secure-scuttlebutt
47 stars 8 forks source link

EBT test sometimes failing #71

Closed staltz closed 3 years ago

staltz commented 3 years ago
  Encrypted

2020-12-09T13:51:40.325Z jitdb all(): 1ms, total messages: 0
    ✔ no err
/home/runner/work/ssb-db2/ssb-db2/test/ebt.js:53
        t.equal(msg.value.content, content)
                    ^

TypeError: Cannot read property 'value' of undefined
    at /home/runner/work/ssb-db2/ssb-db2/test/ebt.js:53:21
    at /home/runner/work/ssb-db2/ssb-db2/indexes/base.js:135:18
    at /home/runner/work/ssb-db2/ssb-db2/indexes/base.js:114:23
    at /home/runner/work/ssb-db2/ssb-db2/node_modules/levelup/lib/levelup.js:192:14
    at /home/runner/work/ssb-db2/ssb-db2/node_modules/encoding-down/index.js:75:21

Happens with commit 7f2233f0e66caff6273b23e293e6201d8bc08a15

arj03 commented 3 years ago

I think it has something to do with the setTimeout that makes things behave non-deterministic in that sometimes updateIndexes is not the first then to be called. I'll try cooking up a PR, I'm unable to reproduce either this or #68. Both should be the same problem.

arj03 commented 3 years ago

I don't get it. I have been running the tests more than 100 times locally and at least 7 times now using CI and it doesn't break.

arj03 commented 3 years ago

Looking at the 2 failures they have the thing in common that they are not the first test. So I don't think its related to the init code. They both fail because somehow drain is not working and they get the wrong messages (or none).