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

crash & p2p question #28

Closed
ericbets opened this issue Nov 16, 2017 · 6 comments
Closed

crash & p2p question #28

ericbets opened this issue Nov 16, 2017 · 6 comments

Comments

@ericbets
Copy link

I copied the counter.js file to counter2, counter3 and so on to listen on a few different ports. When I started counter.js on port 3000 and then started counter2.js on port 3001 I received this error:

/tmp/lotion/example/counter/node_modules/lotion/lib/tendermint.js:48
    throw new Error('Tendermint node crashed')
    ^

Error: Tendermint node crashed
    at ChildProcess.tendermintProcess.on /tmp/lotion/example/counter/node_modules/lotion/lib/tendermint.js:48:11)
    at emitTwo (events.js:125:13)
    at ChildProcess.emit (events.js:213:7)
    at maybeClose (internal/child_process.js:927:16)
    at Socket.stream.socket.on (internal/child_process.js:348:11)
    at emitOne (events.js:115:13)
    at Socket.emit (events.js:210:7)
    at Pipe._handle.close [as _onclose] (net.js:547:12)

Once this issue gets solved, all I need to do is /dial_seeds to get them linked up right?

@ericbets ericbets changed the title p2p question crash & p2p question Nov 16, 2017
@keppel
Copy link
Owner

keppel commented Nov 16, 2017

awesome, thanks for creating this issue, Eric! looks like this is a bug I added in a recent release, caused by two nodes on the same machine trying to use the same tendermint home. will fix this now.

I'm also just about to push some stuff that'll make your nodes discover and peer with each other automatically, no need to think about /dial_seeds. I'll ping you here as soon as that's published to double check that everything's working as expected!

🙌

@ericbets
Copy link
Author

Regarding the auto node discovery / peering stuff, I get the possibly erroneous impression that you want apps to use the same global chain? Though I can guess why you might go there (cosmos), it seems like a controversial engineering decision. From my efficiency minded perspective, it would be nice if there was a way to segment state machines simply. One approach to do this in Tendermint core without introducing deliberate namespaces would be for clusters to agree on a random 1Kb string at the start of a chain. Then if two clusters clash they can easily maintain their respective chains without worrying about a phat bandwidth bill.

@keppel
Copy link
Owner

keppel commented Nov 16, 2017

nah, no global chain, just peer discovery for your own chain through the bittorrent DHT and multicast DNS (through this module).

you can also specify your own initial seed peers like

let app = require('lotion')({ peers: ['localhost:46658'] })

but there's no way to set the p2p port to use at the moment. that'll also be added in the next published version.

cosmos is all about independent, application-specific blockchains that can interoperate through common protocols. it's not about forcing your app to use any particular blockchain. you could even use Lotion for a completely private blockchain.

@keppel
Copy link
Owner

keppel commented Nov 17, 2017

hey @ericbets, have another look at the example now! should work if you run node app and node peer

😊

@keppel keppel closed this as completed Nov 17, 2017
@ericbets
Copy link
Author

I got a crash before I was able to start a 3rd peer to see if 2 nodes was buggy.

app.js https://gist.github.com/ericbets/18eb514190bc02066a62c1112d087fd8
peer.js https://gist.github.com/ericbets/dd271a22ff513cf61fa98adcdc0e5547

@keppel
Copy link
Owner

keppel commented Nov 18, 2017

ah, sorry about that, looks like when you ran it, it connected to the node I had running as well as starting a new chain, and since my node uses the same private key as yours for this example, it looks like a double-sign / fork to tendermint.

I updated the example so that now your nodes will only peer with each other, should be pretty straight forward to extend the example to include more peers if that's what you're interested in testing!

thanks @ericbets!

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

2 participants