Skip to content
This repository has been archived by the owner on Jan 7, 2022. It is now read-only.

dat.close() should probably also call dat.leave() #173

Open
cblgh opened this issue Oct 20, 2017 · 4 comments
Open

dat.close() should probably also call dat.leave() #173

cblgh opened this issue Oct 20, 2017 · 4 comments

Comments

@cblgh
Copy link

cblgh commented Oct 20, 2017

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.

@okdistribute
Copy link
Collaborator

Hey @cblgh , couldn't reproduce and I added a test. #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

@joehand
Copy link
Collaborator

joehand commented Oct 20, 2017

+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.

@garbados
Copy link

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

@joehand
Copy link
Collaborator

joehand commented Dec 28, 2017

Hmm, thanks. Look likes neither bittorrent-dht or dns-discovery are getting closed. Will look into those!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants