Comments (6)
I've modified the JS to check for the server being closed before throwing:
ConnDB.prototype._serialize = function () {
var e_2, _a;
var record = {};
try {
for (var _b = __values(this._map.entries()), _c = _b.next(); !_c.done; _c = _b.next()) {
var _d = __read(_c.value, 2), address = _d[0], data = _d[1];
record[address] = data;
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_2 && this._closed === false) throw e_2.error; }
}
return record;
};
But now I'm getting:
test/basic.js 2> at ConnDB._write (/home/christianbundy/src/fraction/oasis/node_modules/ssb-conn-db/lib/index.js:158:25)
test/basic.js 2> at Timeout._onTimeout (/home/christianbundy/src/fraction/oasis/node_modules/ssb-conn-db/lib/index.js:174:19)
test/basic.js 2> at listOnTimeout (internal/timers.js:549:17)
test/basic.js 2> at processTimers (internal/timers.js:492:7)
from ssb-conn-db.
It looks like this._map.clear()
is setting this._map
to null
and doing the same for this._stateFile
. My guess is that we need to sprinkle in some assertNotClosed()
in there, but that the real bug is me maintaining a naive script to emulate conn.hops
here: ssbc/ssb-conn#16
from ssb-conn-db.
@christianbundy I don't understand this bug. this._map
is only null
when connDB.close()
is called. But connDB.close()
will also cancel any existing setTimeout
...
I released ssb-conn-db 0.3.2 with some more assertions, try that out. But I'm not sure it'll solve it.
from ssb-conn-db.
test/lifecycle.js 1> message: 'This ConnStaging instance is closed, create a new one.',
test/lifecycle.js 1> name: 'Error',
test/lifecycle.js 1> stack: 'Error: This ConnStaging instance is closed, create a new one.\n' +
test/lifecycle.js 1> ' at ConnStaging._assertNotClosed (/home/christianbundy/src/fraction/oasis/node_modules/ssb-conn-staging/lib/index.js:27:19)\n' +
test/lifecycle.js 1> ' at ConnStaging.liveEntries (/home/christianbundy/src/fraction/oasis/node_modules/ssb-conn-staging/lib/index.js:77:14)\n' +
test/lifecycle.js 1> ' at Object.CONN.stagedPeers (/home/christianbundy/src/fraction/oasis/node_modules/ssb-conn/lib/conn.js:61:48)\n' +
test/lifecycle.js 1> ' at Object.hooked (/home/christianbundy/src/fraction/oasis/node_modules/hoox/index.js:10:15)\n' +
test/lifecycle.js 1> ' at Object.localCall (/home/christianbundy/src/fraction/oasis/node_modules/muxrpc/local-api.js:31:29)\n' +
test/lifecycle.js 1> ' at Object.<anonymous> (/home/christianbundy/src/fraction/oasis/node_modules/muxrpc/local-api.js:37:22)\n' +
test/lifecycle.js 1> ' at PacketStreamSubstream.stream.read (/home/christianbundy/src/fraction/oasis/node_modules/muxrpc/stream.js:69:23)\n' +
test/lifecycle.js 1> ' at PacketStream._onstream (/home/christianbundy/src/fraction/oasis/node_modules/packet-stream/index.js:228:11)\n' +
test/lifecycle.js 1> ' at PacketStream.write (/home/christianbundy/src/fraction/oasis/node_modules/packet-stream/index.js:135:41)\n' +
test/lifecycle.js 1> ' at /home/christianbundy/src/fraction/oasis/node_modules/muxrpc/pull-weird.js:56:15'
test/lifecycle.js 1> }
Woo!
from ssb-conn-db.
Wait, does this mean it's resolved for you? Or do we have a new issue for conn-staging (not conn-db)?
from ssb-conn-db.
Yep, this is resolved for me. The bug was coming from my hacky scheduler add-on, which was running ssb.connect()
on staged peers (and didn't have any close()
handling). My approach is super fraught, I've opened a PR to make the replication hops configurable (ssbc/ssb-conn#17) but can just fork SSB-CONN if it isn't something you'd like to merge.
from ssb-conn-db.
Related Issues (3)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ssb-conn-db.