Xud: Weird behavior when connecting to already connected peer with wrong nodepubkey

Created on 16 Aug 2018  路  2Comments  路  Source: ExchangeUnion/xud

So this is a pretty obscure edge case but I spent several hours trying to figure out why this is happening without any success so far.

This issue can be recreated by:

  1. Connecting to a peer (with the right pubkey)
  2. Connecting to that same peer with the wrong pubkey, but same host/port. Here you will see that the peer is closed post handshake and socket supposedly destroyed.
  3. Disconnecting from the peer. At this point listpeers will not return the peer.
  4. Shutting down xud via xucli shutdown.
  5. Observing that the server will not shutdown, and you will continue to have ping pongs with the peer you connected to in steps 1&2.

It can also be recreated by going into test/p2p/sanity.spec.ts and moving the should fail when connecting to an unexpected node pub key test case above the should disconnect successfully test case. After doing that, run npm run test:p2p and you'll see the same thing, the test will never end and ping pongs will keep being passed back and forth.

This is a low priority because it's such a weird edge case, but it may be indicative of something we're doing wrong in the p2p layer. I'll revisit this issue at some point, but I hit a wall trying to solve it yesterday and if another set of eyes wants to take a look at it that would be great.

bug p2p

Most helpful comment

Tested this today to verify this is no longer an issue.

All 2 comments

Confirmed that this is still an issue.

Tested this today to verify this is no longer an issue.

Was this page helpful?
0 / 5 - 0 ratings