IntersectMBO / IntersectMBO/ouroboros-network

cardano-cli ping: Reduce TCP timeout or add timeout option

Open
#4,866 0 comments 1 reaction 0 assignees View on GitHub
cardano-ping
Dominant language
Haskell
Stars
296
Forks
104
Avg merge
2d 10h
Merged PRs (30d)
4

Description

## Description

`cardano-cli ping` takes around 1 minute and 30 seconds (apparently the default TCP timeout) until it exits when specifying a non-existent address, port or offline target.

## Steps to Reproduce

1. Run `cardano-cli` against a non-existent address, port or offline target:

```
time cardano-cli ping --host 10.10.10.10 --port 1337 --count 1
```

2. Verify the time

```
real 1m31.542s
user 0m0.003s
sys 0m0.003s
```

## Expected behavior

Ideally, `cardano-cli` ping would offer an option (`--timeout 10`) to specify the timeout or exit after a reasonable timeout (maybe 10 seconds).

## Actual behavior

`cardano-cli` ping times out after around 1 minute 30 seconds, which is quite long for working with the tools in scripts.

## Workaround

I am currently using the Linux `timeout` command and can live without this feature being added:
```
timeout 10 cardano-cli ping --host 10.10.10.10 --port 1337 --count 1
```

## Additional Context

I am using the `cardano-cli` version from the compiled `cardano-node` tarball 8.9.2:

- cardano-node:

```
$ cardano-node version
cardano-node 8.9.2 - linux-x86_64 - ghc-8.10
git rev 424983fa186786397f5a99539f51710abf62c37b
```

- cardano-cli:

```
$ cardano-cli version
cardano-cli 8.20.3.0 - linux-x86_64 - ghc-8.10
git rev 424983fa186786397f5a99539f51710abf62c37b
```

Please let me know if you need additional information or you want me to test with different `cardano-cli` versions. Thanks.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.