cabal-club / cabal-cli

Terminal client for Cabal, the p2p chat platform.

Home Page:https://cabal.chat

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to connect to peer immediately; works after several restarts

dwblair opened this issue · comments

Hi! I'm having so much fun using cabal. Thank you all for your hard work on this!!

I've been experimenting with connecting with remote peers (friends), and I'm sometimes having trouble. I know (via gchat, phone, etc) that they're online, but don't see them listed as a live 'peer'; and our messages don't make it back and forth. Then, I'll restart cabal a couple of times, and some of the messages will appear -- but live chat still doesn't work. Then, in some cases, after a couple of restarts (I believe -- sorry, i haven't detected a pattern yet!), I do end up being able to chat live. Any thoughts as to what might be going on?

On both ends, we've received an error message (sometimes) upon start:

Hi! I'm also experiencing something like this, I think -- my main issue has been that sometimes I'm unable to connect with a remote peer, even when I know they are online and sending me messages ... and then I've restarted cabal a couple of times ... and then some of the messages appear, but I still can't chat 'live' ... and then eventually I've ended up being able to connect 'live'.

I'm not sure if it's related, but on both ends of the connection we've received the error message:

(node:30521) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 update listeners added. Use emitter.setMaxListeners() to increase limit

I'm not sure if this is related ... ?

Thanks again for all the hard work on this -- I'm going to try running a cabal workshop with some farmers in Maine who are mostly off-grid, and I'm super excited to show them all of this awesomeness.

Cheers!
Don

Hmm, this is interesting. I’m seeing similar behaviour with my kappa-chat implementation from the Kappa Architecture Workshop.

I think I’ve narrowed it down where if I have one node going locally and someone starts a node remotely, I don’t get notified. If I run a second node locally, then both local nodes connect to the remote one. It might be a different issue or it might be related to how I’m setting up hyperswarm, possibly (going to look into that). Not sure if Cabal is using hyperswarm also now or whether it is on discovery-swarm.

Cool that you attended the Kappa workshop -- the materials look really cool!

After using cabal cli more recently, I've found several times that, only running a single cabal cli, I will suddenly be able to connect if I restart the cli. My crude guess, based on little evidence, is that perhaps the cabal attempts to connect to the swarm initially, isn't successful / loses the connection, and then on restart is forced into trying again. If something like this is true, perhaps there's a way to trigger this reconnect process from within the cli, after a certain amount of time has passed -- or even manually, with e.g. a "/reconnect" command ...

I think this was being caused by bugs in discovery-swarm. We're in the process of switching to hyperswarm, which should fix this. If you want to apply a fix yourself locally though, you could try 4f3ca4ad921a48ac678fe2f4b05bb48e0ecae161.

This should be greatly improved since our move to hyperswarm.