Crash in ssb-db2 private when resuming compaction
staltz opened this issue · comments
Reproduction
- ssb-db2 4.2.1
- jitdb 7.0.2
- async-append-only-log 4.3.6
- Manyverse codebase
Reproduction steps:
- Delete some feeds
- Start compaction
- In the middle compaction, kill/crash the app
- Reopen the app
- Compaction resumes but the following crash happens
This is the line:
Line 151 in 44c4b04
And it was called from
Line 179 in 44c4b04
Which means it's reading from the canDecrypt
index
Analysis
This means that the ciphertext is not a string. But the record is non-deleted because there is a check for non-null records.
So what I think this means is that the msg.value.content is an object, thus non-encrypted record. More guessing tells me that when the app re-opened, we allowed db2 queries to happen, and those might be using outdated offsets (because reindexing has not yet kicked in). And no db2 queries should happen at this point.
I think that the culprit is
Line 104 in 44c4b04
because in this case the default value should be true
, but because it's false
then the queries are allowed to proceed:
Lines 696 to 697 in 44c4b04
But it seems like we can just use the synchronous log.compactionProgress.value.done
because it is synchronously defined by AAOL on startup:
Assume fixed by #381