I noticed that this issue only happens if I run simultaneous write queries running on multiple CLI.
Issue does not occur if I only have a single process writing to the database.
When issue occurs, an error message appears on the console log Cannot set properties of null (setting 'prev').
The document is created successfully on the DB contract. However, WAL contract displays the data property as null.
Issue occurs from the rollup.js file on this code execution await this.wal.set(t, "txs", `${t.id}`)
I tried to change it to the code below to capture the error.
Then, I found that the error happened on BPT.js lib.
TypeError: Cannot set properties of null (setting 'prev')
at BPT._split (/Users/marss/Documents/GitHub/rdk/node/node-server/node_modules/weavedb-contracts/weavedb-bpt/lib/BPT.js:982:17)
at async BPT.split (/Users/marss/Documents/GitHub/rdk/node/node-server/node_modules/weavedb-contracts/weavedb-bpt/lib/BPT.js:1022:27)
at async BPT.insert (/Users/marss/Documents/GitHub/rdk/node/node-server/node_modules/weavedb-contracts/weavedb-bpt/lib/BPT.js:932:30)
at async put (/Users/marss/Documents/GitHub/rdk/node/node-server/node_modules/weavedb-contracts/weavedb-bpt/lib/index.js:527:5)
at async set (/Users/marss/Documents/GitHub/rdk/node/node-server/node_modules/weavedb-contracts/weavedb-bpt/actions/write/set.js:45:27)
at async OffChain.handle (/Users/marss/Documents/GitHub/rdk/node/node-server/node_modules/weavedb-contracts/weavedb-bpt/contract.js:221:40)
at async OffChain.write (/Users/marss/Documents/GitHub/rdk/node/node-server/node_modules/weavedb-offchain/index.js:224:14)
at async OffChain.writeWithoutWallet (/Users/marss/Documents/GitHub/rdk/node/node-server/node_modules/weavedb-offchain/node_modules/weavedb-base/index.js:1244:12)
at async OffChain._write2 (/Users/marss/Documents/GitHub/rdk/node/node-server/node_modules/weavedb-offchain/node_modules/weavedb-base/index.js:389:14)
at async OffChain._write (/Users/marss/Documents/GitHub/rdk/node/node-server/node_modules/weavedb-offchain/node_modules/weavedb-base/index.js:324:12)
I sent a PR for the test case #22
I noticed that this issue only happens if I run simultaneous write queries running on multiple CLI. Issue does not occur if I only have a single process writing to the database. When issue occurs, an error message appears on the console log
Cannot set properties of null (setting 'prev')
. The document is created successfully on the DB contract. However, WAL contract displays thedata
property as null.Issue occurs from the
rollup.js
file on this code executionawait this.wal.set(t, "txs", `${t.id}`)
I tried to change it to the code below to capture the error.Then, I found that the error happened on
BPT.js
lib.