dat-node
dat-node copied to clipboard
dat.close() should probably also call dat.leave()
I was writing a scraper for Rotonde and seeing massive memory leaks in a short amount of time, this despite calling dat.close()
. A friend debugged the cause to the network not being left; adding dat.leave()
appears to have solved that issue.
Is this intended behaviour of dat.close()
? If that's the case y'all might want to mention dat.leave()
in the same paragraph as dat.close()
in the readme.
Hey @cblgh , couldn't reproduce and I added a test. https://github.com/datproject/dat-node/pull/174
It seems like dat.leave()
is getting called. I wonder if you can find out what your self.network
is here when you run close
, just to make sure the code path isn't getting skipped (it seems like if self.network
doesn't exist, it will just return out with no message)
https://github.com/datproject/dat-node/blob/master/dat.js#L227
+1 to what karissa said while I was typing =)
If you can, run the one with a leak with DEBUG=dat-node
to see if its trying to call leave, its possible the mutlicb thing isn't doing what is expected.
I have been having a similar, potentially related issue. I haven't been able to reproduce the problem in isolation, but it occurs reliably during the test suite for dat-friend. I've created an issue in that repo with some log details, such as an excerpt of results from DEBUG=* npm test
Hmm, thanks. Look likes neither bittorrent-dht or dns-discovery are getting closed. Will look into those!