Level/party

Issue when two processes are accessing same level db instance (same folder name during level party setup)

Closed this issue · 0 comments

I have two node js processes running on two different ports (websoket servers), I try to use same level db instance from both. When I was not using level-party, the second process (node server) would not even start. But after using level-party, both processes start properly and work for some cases. But in some cases I see the following error and the corresponding process terminates.
This happens consistently, The one that fails is the server which started later. Possibly it could be due to the levelgraphdb im using, as normal queries work fine, but only on graph search this fails.
Also if one process is stopped, the same queries work fine.

Here is the error.

events.js:85
throw er; // Unhandled 'error' event
^
EncodingError: Unexpected token o
at /node_modules/level-party/node_modules/multileveldown/node_modules/levelup/lib/read-stream.js:60:28
at Iterator.next (/node_modules/level-party/node_modules/multileveldown/leveldown.js:265:12)
at Array. (/node_modules/level-party/node_modules/multileveldown/leveldown.js:96:26)
at eval [as _decode](eval at %28/node_modules/level-party/node_modules/multileveldown/node_modules/pbs/node_modules/generate-function/index.js:55:21%29, :20:22)
at Decoder._pushMessage (/node_modules/level-party/node_modules/multileveldown/node_modules/pbs/decoder.js:130:10)
at Decoder._parseMissing (/node_modules/level-party/node_modules/multileveldown/node_modules/pbs/decoder.js:102:19)
at Decoder._parse (/node_modules/level-party/node_modules/multileveldown/node_modules/pbs/decoder.js:143:23)
at Decoder._write (/node_modules/level-party/node_modules/multileveldown/node_modules/pbs/decoder.js:193:10)
at doWrite (/node_modules/level-party/node_modules/multileveldown/node_modules/pbs/node_modules/readable-stream/lib/_stream_writable.js:279:12)
at writeOrBuffer (/node_modules/level-party/node_modules/multileveldown/node_modules/pbs/node_modules/readable-stream/lib/_stream_writable.js:266:5)