IntersectMBO / cardano-cli

This repository contains sources for the command-line interface (CLI) tool for interacting with the Cardano blockchain.
Apache License 2.0
39 stars 14 forks source link

[BUG] - `cardano-cli ping --unixsock` not sending pings #49

Closed mkoura closed 1 week ago

mkoura commented 1 year ago

Description

The cardano-cli ping --unixsock is not sending pings. The behavior doesn't seem to correspond with the command name as is potentially confusing for end user.

$ cardano-cli ping --count 5 --unixsock /home/martink/Source/repos/cardano-node/state-cluster0/bft1.socket --magic 42 --json
/home/martink/Source/repos/cardano-node/state-cluster0/bft1.socket network rtt: 0.000
/home/martink/Source/repos/cardano-node/state-cluster0/bft1.socket handshake rtt: 0.000188265s
/home/martink/Source/repos/cardano-node/state-cluster0/bft1.socket Negotiated version NodeToClientVersionV16 42
] }

Also notice the confusing json output.

Tested with cardano-cli 8.2.1 on Linux.


[edit] after discussions with @mkoura and @coot. We will:


[edit] after review by @Jimbo4350 here, we finally decided to:

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 120 days.

smelc commented 10 months ago

Explanation for the confusing json output (trailing ] }): https://github.com/input-output-hk/cardano-cli/issues/197#issuecomment-1723419123

smelc commented 10 months ago

Since this issue was opened, the output was jsonified: https://github.com/input-output-hk/cardano-cli/pull/411, albeit the crux of this issue is still there.

smelc commented 10 months ago

Can reproduce as of 04b1ccf1fc79864b52052138ae1e127ddf853fe9:

→ cabal run cardano-cli -- ping -u $HOME/dev/sanchonet/node.socket --magic 4 -j
/home/churlin/dev/sanchonet/node.socket {"network_rtt":1.1953e-5}
/home/churlin/dev/sanchonet/node.socket {"handshake_rtt":1.48992e-4}
/home/churlin/dev/sanchonet/node.socket {"negotiated_version":{"magic":4,"version":"NodeToClientVersionV16"}}
] }
smelc commented 10 months ago

That's because this conditional in ourboros-network is not entered in the case where isUnixSocket holds.

If I remove the isUnixSocket condition, then cardano-cli ping fails as follows:

> cabal run cardano-cli -- ping -u $HOME/dev/sanchonet/node.socket --magic 4 -c 5 -j
/home/churlin/dev/sanchonet/node.socket {"network_rtt":1.3868e-5}
/home/churlin/dev/sanchonet/node.socket {"handshake_rtt":3.25788e-4}
pintOptsHandshakeQuery: False
querySupported: True
isUnixSocket: True
/home/churlin/dev/sanchonet/node.socket {"negotiated_version":{"magic":4,"version":"NodeToClientVersionV16"}}
] }
(AddrInfo {addrFlags = [], addrFamily = AF_UNIX, addrSocketType = Stream,
 addrProtocol = 0, addrAddress = /home/churlin/dev/sanchonet/node.socket, addrCanonName = Nothing},
 MuxError MuxBearerClosed "<socket: 11> closed when reading data, waiting on next header True")

But at this point, I need to spend more time digging whether the ping protocol can be supported in the case of Unix sockets. This is probably normal that this doesn't work, in which case the user-facing UI of cardano-cli ping needs to be amended, to avoid looking like it supports it, whereas it doesn't.

I'll ask @coot to fill me in and update here accordingly. Expect some delay.

coot commented 10 months ago

@mkoura the node-to-client protocol doesn't include keep-alive mini-protocol, only node-to-node does, so there's no way to send pings on a unix socket. The command is still useful for node-to-client, as it allows to debug connectivity / version mismatch issues. One possible solution would be to simply expose a cardano-cli handshake command which negotiate the connection and limit ping to node-to-node.

github-actions[bot] commented 8 months ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 120 days.

github-actions[bot] commented 4 months ago

This issue was closed because it has been stalled for 120 days with no activity. Remove stale label or comment or this will be closed in 60 days.

github-actions[bot] commented 3 months ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 120 days.

github-actions[bot] commented 2 months ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 120 days.

github-actions[bot] commented 2 weeks ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 120 days.